Quantcast
Channel: Synology — Plex Forums
Viewing all articles
Browse latest Browse all 3609

Plex Media Server Hardware Transcoding on docker on Synology DS216+II

$
0
0

Precaution: Hardware transcoding is still in beta and requires a Plex Pass

This is just a basic instruction to run PMS on DSM using docker, with hardware transcoding feature enable.

The reason I switch from native synology package to docker image is that I'm suffering artefacts (low transcoding quality) issues.

.

Prequest:

  1. Docker installed on DSM.
  2. SSH/Terminal enabled. Official instruction

.

Installation:

I did manage to do get HW Transcoding working on Synology DS216+II using docker by doing to following:

  1. Stop natively installed Plex Media Server.
  2. Open up SSH client and login as admin. Official instruction
  3. Make a new bash file named hw_fix.sh with vim hw_fix.sh.
    if [ -d /dev/dri ]; then
        chmod 755 /dev/dri
        chmod 666 /dev/dri/*
    fi
  1. Type sudo su to grant super user privilege.
  2. Make the shell script executable and run the script by typing chmod +x hw_fix.sh && sh ./hw_fix.sh
  3. Get your PLEX_UID (normally a 4 digital number, like 1025) and PLEX_GID (normally a 3 digital numberm like 100) by running id plex.
  4. Copy and paste the docker command below (modify the command on your situation):

docker run -d --name plex --net=host -e TZ="<TIMEZONE>" -e PLEX_UID="<PLEX_UID>" -e PLEX_GID="<PLEX_GID>" -e PLEX_CLAIM="<PLEX_CLAIM>" -v /volume1/docker/plexmediaserver/config:/config -v /volume1/docker/plexmediaserver/tmp_transcoding:/transcode -v /volume1/photo:/data/photo:ro -v /volume1/video:/data/video:ro --device /dev/dri:/dev/dri plexinc/pms-docker

  1. Once you have your container running, log into it using: docker exec -it plex /bin/bash
  2. Once there, do: curl -J -L -o /tmp/plexmediaserver.deb https://downloads.plex.tv/plex-media-server/1.8.1.4140-82ea538ca/plexmediaserver_1.8.1.4140-82ea538ca_amd64.deb && dpkg -i /tmp/plexmediaserver.deb && exit
  3. Finally, logout the terminal. Visit http://server.local.ip.address:32400/web and setup the whole new server (official guide). Afterwards, goto Settings -> Transcode and turn on the hardware acceleration option (Turn on Show Advanced first and you will see it).
  4. Just enjoy!

.

Docker command breaks down:

PLEX_UID The user id of the plex user created inside the container. You can obtain it by running id plex in the terminal.
PLEX_GID The group id of the plex group created inside the container
TZ Set the timezone inside the container. For example: Europe/London. The complete list can be found here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
PLEX_CLAIM The claim token for the server to obtain a real server token. If not provided, server is will not be automatically logged in. If server is already logged in, this parameter is ignored. You can obtain a claim token to login your server to your plex account by visiting https://www.plex.tv/claim
-v /volume1/photo:/data/photo This maps the local directory /volume1/photo into docker container. You can delete/map more directories using docker gui in DSM.
-v /volume1/photo:/data/photo:ro This maps the local directory /volume1/photo into docker container as read only. You can delete/map more directories using docker gui in DSM.
--device /dev/dri:/dev/dri Ensure the pms running in the container can run with hw transcoding funciton.

.

Tweaks:

Container using offical pms-docker:plexpass image may override the Hardware Transcoding Preview 4 installation after restart. You can modify files below in the container AFTER the above installation to avoid that from happening.

docker exec -it plex /bin/bash
vim installBinary.sh
/installBinary.sh - Comment out all the lines

#!/bin/bash

# . /plex-common.sh

# echo "${TAG}" > /version.txt
# if [ ! -z "${URL}" ]; then
#   echo "Attempting to install from URL: ${URL}"
#   installFromRawUrl "${URL}"
# elif [ "${TAG}" != "plexpass" ] && [ "${TAG}" != "public" ]; then
#   getVersionInfo "${TAG}" "" remoteVersion remoteFile

#   if [ -z "${remoteVersion}" ] || [ -z "${remoteFile}" ]; then
#     echo "Could not get install version"
#     exit 1
#   fi

#   echo "Attempting to install: ${remoteVersion}"
#   installFromUrl "${remoteFile}"
# fi

vim plex-common.sh
/plex-common.sh - Comment out the function installFromRawUrl()

#!/bin/bash

function getVersionInfo {
...
function installFromUrl {
  installFromRawUrl "https://plex.tv/${1}"
}

function installFromRawUrl {
#   local remoteFile="$1"
#   curl -J -L -o /tmp/plexmediaserver.deb "${remoteFile}"
#   local last=$?

#   # test if deb file size is ok, or if download failed
#   if [[ "$last" -gt "0" ]] || [[ $(stat -c %s /tmp/plexmediaserver.deb) -lt 10000 ]]; then
#     echo "Failed to fetch update"
#     exit 1
#   fi

#   dpkg -i --force-confold /tmp/plexmediaserver.deb
#   rm -f /tmp/plexmediaserver.deb
#
  echo "bypass installation"
}

exit

.

Others:

The instruction may apply to other Synology models with docker feature supported.

The draw back here is that this is a NEW server and you have to mannually add your library again.

I tried to mapping the existing Library by running the docker command with -v /volume1/Plex:/config -v /volume1/tv:/volume1/tv:ro. But I suffered with new problems, such as codec not found, no permission to transcode folder etc.

.

Reference:

  1. https://forums.plex.tv/discussion/277413/plex-media-server-hardware-transcoding-on-synology-ds216-ii/p1
  2. https://forums.plex.tv/discussion/282845/plex-media-server-hardware-transcoding-preview-4-1-8-1-4140/p1

.

Thanks:

Thanks to @ChuckPA @erik_de_bont and the Dev team for all their efforts.

I'm just new to docker so comments are welcome!


Viewing all articles
Browse latest Browse all 3609

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>