Plex Media Server
This guide was written for Synology DS1520+, but should work on any Linux-based system with Docker installed. Some steps may vary depending on your platform.
Installation
Prerequisites
- Docker (installation guide)
- Compatible Intel-based PC or NAS with Quick Sync Video support (optional, but required for hardware transcoding)
- Plex Pass subscription (optional, but required for hardware transcoding)
Docker container
-
Pre-download the latest docker image:
Terminal window sudo docker pull ghcr.io/hotio/plexNormally we’d run
sudo docker compose pull && sudo docker compose up -dafter creating adocker-compose.yamlfile, but we’ll be time limited by thePLEX_CLAIM_TOKENin a later step. -
Create a new docker compose file:
Terminal window nano docker-compose.yaml -
Copy and paste the following configuration into the file:
docker-compose.yaml services:plex:container_name: pleximage: ghcr.io/hotio/plexports:- "32400:32400"environment:- PUID=1000- PGID=1000- UMASK=002- TZ=Etc/UTC- PLEX_CLAIM_TOKEN- PLEX_ADVERTISE_URL- PLEX_NO_AUTH_NETWORKS- PLEX_BETA_INSTALL=false- PLEX_PURGE_CODECS=falsevolumes:- /<host_folder_config>:/config- /<host_folder_transcode>:/transcode- /<host_folder_data>:/data -
Change
PUIDandPGIDto the user and group ID you want the container to run as:docker-compose.yaml environment:- PUID=1000- PGID=1000tip You can find these by running
id <username>on your host system. -
Change
TZto your local timezone. List of tz database time zones.docker-compose.yaml environment:- TZ=Etc/UTC -
Replace
<host_folder_config>,<host_folder_transcode>, and<host_folder_data>with the paths to the directories on your host where you want to store Plex configuration files, transcoder temporary files, and media files respectively.docker-compose.yaml volumes:- /<host_folder_config>:/config- /<host_folder_transcode>:/transcode- /<host_folder_data>:/data -
Log into the Plex website and copy your claim token. This links your server to your Plex account automatically.
docker-compose.yaml environment:- PLEX_CLAIM_TOKEN=<your_token_here>The
PLEX_CLAIM_TOKENis only valid for 4 minutes after being generated. Make sure to immediately start your container after copying the code. -
Save the file and start the container:
Press Ctrl + O to save the file and Ctrl + X to exit.
Recreate and start the Plex container:
Terminal window sudo docker compose up -d -
Test your setup by navigating to
http://<your_server_ip>:32400/webin your web browser. You should see the Plex web interface where you can complete the setup and add your media libraries. -
Forward the necessary ports on your router if you want to access Plex outside your local network. The default port is
32400.
Hardware-accelerated streaming
-
Edit your
docker-compose.yamlfile to include thedevicessection to enable hardware transcoding:docker-compose.yaml services:plex:container_name: pleximage: ghcr.io/hotio/plexports:- '32400:32400'environment:- PUID=1000- PGID=1000- UMASK=002- TZ=Etc/UTC- PLEX_CLAIM_TOKEN- PLEX_ADVERTISE_URL- PLEX_NO_AUTH_NETWORKS- PLEX_BETA_INSTALL=false- PLEX_PURGE_CODECS=falsevolumes:- /<host_folder_config>:/config- /<host_folder_transcode>:/transcode- /<host_folder_data>:/datadevices:- /dev/dri:/dev/dri -
Restart your Plex container to apply the changes:
Terminal window sudo docker compose pull && sudo docker compose up -d -
Enable hardware acceleration
To use Hardware-Accelerated Streaming in Plex Media Server, you need to enable it using the Plex Web App.
- Open the Plex Web app.
- Navigate to
Settings > Server > Transcoderto access the server settings. - Toggle
Show Advancedin the upper-right corner to expose advanced settings. - Enable
Enable HDR tone mapping,Use hardware acceleration when availableandUse hardware-accelerated video encoding. - Click
Save Changesat the bottom.
-
To check to see if hardware acceleration is being used during a video playback:
- Play a video on any Plex app.
- In the quality settings of the Plex player app, reduce the video quality to force Plex Media Server to convert the video (for example, select
Convert to 480p). - Open the Plex Web App.
- In the Plex Web App, click on the
Activityicon in the upper-right corner. - Visit the
Dashboardfor the playing video - Use the toggle at the top right of the Now Playing area to expose additional details of the playback
- When hardware acceleration is being used, you should see
(hw)next to theVideoformat.
Troubleshooting
Buffering issues
If you encounter buffering during playback, make sure hardware acceleration is enabled and try increasing Transcoder default throttle buffer under Settings > Server > Transcoder to 600 seconds.
Playback on local network shows as remote
If playback on your local network is showing as remote, you may need to change the network mode of the container to host to allow Plex to correctly identify local network traffic.
Remote streams are limited to a lower bitrate compared to local streams, which can affect playback quality.
Edit your docker-compose.yaml file to include network_mode: host:
services: plex: container_name: plex image: ghcr.io/hotio/plex network_mode: host ports: - '32400:32400' environment: - PUID=1000 - PGID=1000 - UMASK=002 - TZ=Etc/UTC - PLEX_CLAIM_TOKEN - PLEX_ADVERTISE_URL - PLEX_NO_AUTH_NETWORKS - PLEX_BETA_INSTALL=false - PLEX_PURGE_CODECS=false volumes: - /<host_folder_config>:/config - /<host_folder_transcode>:/transcode - /<host_folder_data>:/dataPlex support
For more detailed troubleshooting, please refer to the official Plex Support website.
References
The following sources were used while writing this guide: