FreeBSD 12.0 / Hardware transcoding issue

Ignore the port instructions on the driver package they are not needed.

1.16.6 doesn’t include all the recent fixes.

Fine - now running the latest beta. Upon access I get this:

PlexMediaServer-1.17.0.1709-982421575 # Exception AttributeError: "'ZipArchive' object has no attribute '_zip'" in <bound method ZipArchive.__del__ of <Framework.components.data.ZipArchive object at 0x809ad90d0>> ignored

After watching a video and triggering transcoding I get the following:

failed to open /data/jenkins/conan_build/1154421690/conan/.conan/data/libva/2.4.0-1/plex/stable/package/242b5c997bd71de020658d1658b4b53c50ea1b39/lib/dri/hybrid_drv_video.so
Not using hybrid_drv_video.so

I’m starting via start.sh without any other system changes (save for old PMS removal).

Normal playback works without any issues.

That won’t work, you need to use the system rc.d script.
But also I provided a script above that handles all that, if you not using a jail you can easily adapt it to work on the host.

I’ll look into 1.16.6 see if it fails for me to though cause it shouldnt.

OK, modified your code to work without jails:

#!/bin/sh
# Uses PMS API to check for updates
# Downloads Updates if available
# Installs to jail using ports system

PLEX_PORT_PATH="/usr/ports/multimedia/plexmediaserver"
PLEX_PKG_NAME="plexmediaserver"
SERVER_URL="http://10.5.5.33:32400"

release_info=""
download_url=""

split_version_sufix()
{
  version_prefix=$(echo $1 | cut -d "-" -f1)
  version_sufix=$(echo $1 | cut -d "-" -f2)
}


check_updates()
{
  ##fetch -qo - SERVER_URL/updater/status | egrep -o '([0-9]+(\.|-)){4}([a-z|0-9]+)'
  ## I wanted no deps but fetch doens't support post/put, and httpie'jq = awesomeness

  echo -e "Checking for updates...\n"
  http PUT $SERVER_URL/updater/check > /dev/null
  release_info=$(http --json -b $SERVER_URL/updater/status | jq '.MediaContainer.Release[]')
  if [ ! -z "$release_info" ]; then

    state=$(echo $release_info| jq -r '.state')
    new_version=$(echo $release_info| jq -r '.version')
    whats_new=$(echo $release_info| jq -r '{added,fixed} |to_entries[] | "  \(.key):   \(.value)"')
    download_url=$(echo $release_info| jq -r '.downloadURL')
    if [ "$state" == "notify" ]; then
      echo -e "New Update Available\nRelease info:\n"
      echo -e "Version: $new_version"
      echo -e "What's New: \n$whats_new\n\n"
    fi
  else
    echo "No updates available what the time"
    exit 1
  fi
}

check_pkg_version()
{
  pkg query %v plexmediaserver
}

download_new_version()
{
  cd /usr/ports/distfiles
  http -bd $download_url # TODO: add continue mode; need filename
  cd -
}

update_port_makefile()
{
  # expects version_prefix and sufix as arg1 and arg2
  portVersion=$(make -C $PLEX_PORT_PATH -V PORTVERSION)
  portVersionSufix=$(make -C $PLEX_PORT_PATH -V DISTVERSIONSUFFIX)

  echo "PORTVERSION: $portVersion || DISTVERSIONSUFFIX: $portVersionSufix"

  today=$(date +%F)
  sed -i "_$today.bk" "s/$portVersion/$1/" "$PLEX_PORT_PATH/Makefile"
  sed -i "_$today.bk" "s/$portVersionSufix/$2/" "$PLEX_PORT_PATH/Makefile"

  echo -e "\nMakefile Updated:"
  echo "PORTVERSION: $(make -C $PLEX_PORT_PATH -V PORTVERSION) || DISTVERSIONSUFFIX: $(make -C $PLEX_PORT_PATH -V DISTVERSIONSUFFIX)"
}

make_package()
{
  make -sC $PLEX_PORT_PATH clean
  make -sC $PLEX_PORT_PATH makesum
  make -sC $PLEX_PORT_PATH package
}

upgrade_pkg()
{
  # expects version prefix as arg
  service plexmediaserver stop
  pkg remove -y $PLEX_PKG_NAME
  pkg install -y $PLEX_PORT_PATH/work/pkg/$PLEX_PKG_NAME-$1.txz
  service plexmediaserver start
}


check_updates
pkg_version=check_pkg_version


### Main ###
# TODO: add optional params
if [ ! -z "$pkg_version" ]; then
  split_version_sufix $new_version
  if [ "$version_prefix" == "$pkg_version" ]; then
    echo "This version ($verion_prefix) is already installed!"
  else
    download_new_version
    echo -e "\n\nUpdate Port Makefile"
    update_port_makefile $version_prefix $version_sufix
    echo -e "\nTime to make the port/package ..."
    make_package
    echo -e "\nUpgrade the port and restart PMS "
    upgrade_pkg $version_prefix
  fi
fi

Upon execution I get:

# ./.plexupdate
Checking for updates...

parse error: Invalid numeric literal at line 1, column 60
No updates available what the time

Sorry, couldn’t determine how to fix this.

Is the server pointed to beta? also did u allowed that ip without auth?

I can actually just send u a txz in DM, old on a bit

No need - that IP list fixed it. :slight_smile: Will revert…

When using browser clients to transcode I get ‘s1001’ (Network).

The android app reports that connection to PMS was lost.

The dashboard shows no transcoding attempts - software of hardware.

can you post pkg info | grep plex and sockstat -l46 ?

Also logs are a bit noisy now, can you:

service plexmediaserver stop
cd /usr/local/plexdata/Plex\ Media\Server/Logs
rm -rf *.log
service plexmediaserver start

And get new logs?

Here’s the info:

# pkg info | grep plex
plexmediaserver-1.17.0.1709    Plex Media Server component
# sockstat -l46
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
plex     Plex Scrip 12775 4  tcp4   127.0.0.1:37176       *:*
plex     Plex DLNA  12611 12 udp4   *:1900                *:*
plex     Plex DLNA  12611 15 tcp4   *:1529                *:*
plex     Plex DLNA  12611 18 udp4   *:8122                *:*
plex     Plex DLNA  12611 21 udp4   *:9572                *:*
plex     Plex DLNA  12611 24 tcp4   *:32469               *:*
plex     Plex DLNA  12611 27 udp4   *:31806               *:*
plex     Plex DLNA  12611 30 udp4   *:57973               *:*
plex     Plex Tuner 11770 13 tcp4   127.0.0.1:32600       *:*
plex     Plex Scrip 10665 8  tcp4   127.0.0.1:22707       *:*
plex     Plex Media 9846  60 tcp46  *:32400               *:*
plex     Plex Media 9846  61 tcp4   127.0.0.1:32401       *:*
plex     Plex Media 9846  71 udp4   *:32414               *:*
plex     Plex Media 9846  72 udp4   *:32410               *:*
plex     Plex Media 9846  73 udp4   *:32412               *:*
plex     Plex Media 9846  74 udp4   *:32413               *:*
plex     Plex Media 9846  75 udp4   10.5.5.33:14505       *:*
plex     Plex Media 9846  76 udp4   10.5.5.33:34900       *:*
plex     Plex Media 9846  77 udp4   *:1901                *:*
plex     Plex Media 9846  78 udp4   10.5.5.33:59080       *:*
root     sshd       35131 3  tcp6   *:22                  *:*
root     sshd       35131 4  tcp4   *:22                  *:*
root     smbd       93821 34 tcp4   10.5.5.33:445         *:*
root     smbd       93821 35 tcp4   10.5.5.33:139         *:*
root     nmbd       90684 15 udp4   *:137                 *:*
root     nmbd       90684 16 udp4   *:138                 *:*
root     nmbd       90684 17 udp4   10.5.5.33:137         *:*
root     nmbd       90684 18 udp4   10.5.5.255:137        *:*
root     nmbd       90684 19 udp4   10.5.5.33:138         *:*
root     nmbd       90684 20 udp4   10.5.5.255:138        *:*
root     syslogd    47156 6  udp6   *:514                 *:*
root     syslogd    47156 7  udp4   *:514                 *:*

Any luck getting to the bottom of this?

Now tested using the same file on CentOS 8 (which JUST got released yesterday…). Absolutely no problems using HWT and in comparison to BSD that transcoding is FAST.

I’ll do some more testing and reflect on non-native ZFS support and its implications. Might just stick with CentOS as I was curious about it for a while anyway. Thanks for all your help.

Just to give an update on this to others I’m discussing this in DM see what might be the problem with this particular case.

It think its best to close this but I’ll leave the requirements that I’ve confirmed work in my setup:

 pkg install drm-fbsd12.0-kmod

 For jails, make a devfs ruleset to expose /dev/dri/* devices.

e.g., /dev/devfs.rules on the host:

[plex_drm=10]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_jail
add path ‘dri*’ unhide
add path ‘dri/’ unhide
add path 'drm’ unhide
add path ‘drm/*’ unhide

Enable the devfs ruleset for your jail. e.g., devfs_ruleset=10 in your /etc/jail.conf or for iocage, iocage set devfs_ruleset=“10”


Add plex user to the video group: pw groupmod -n video -m plex (on the host or jail depending on the case)

Enable HWT on the Server settings

This is for FREEBSD 12.0, I have no guarantees this works in FreeNAS as they ship their own kernel module and you can’t install a more recent drm-kmod, its also not using FreeBSD 12 kernel yet… so put simply there’s to many unknowns.

1 Like