Plex DVR in Docker with Commercial Stripping

Note: This is a working progress. I wrote it very fast so I would not forget how to setup this solution myself. All this information can be found elsewhere on the internet, however I think it is useful to have it in one spot for reference. Use at your own risk.

My media server’s host OS crashed recently because of a boneheaded mistake I made while running some commands as root (doh). I had been reading some information about Docker and thought I would try to rebuild it using Docker containers.

First I needed to get Plex Media Server back up and running. A google search later I found  Plex has an official Docker container. Score!

Install host OS:
I am running all these commands on a fresh installation of Ubuntu 16.04 64bit with updates applied.
sudo apt-get update
sudo apt-get upgrade

Install Docker on your OS:
First you will need a working Docker installation. I am using Docker on Ubuntu 16.04, however it works on other OS versions.
https://docs.docker.com/engine/installation/

Install the Official Plex Docker Container:
Note: Don’t forget to install the Plex Pass version for DVR functionality. ( plexinc/pms-docker:plexpass )
https://github.com/plexinc/pms-docker

The container was very easy to setup. I used the following commands to download and run the Plex Docker.

Create the needed directories:
sudo -i
mkdir -p /docker/containers/plex/{config,transcode}
chown -R <user>:<user> /docker

Install and run the Plex Docker (I am installing in Bridged Networking Mode):
docker run \
-d \
 --name plex \
   -p 32400:32400/tcp \
   -p 3005:3005/tcp \
   -p 8324:8324/tcp \
   -p 32469:32469/tcp \
   -p 1900:1900/udp \
   -p 32410:32410/udp \
   -p 32412:32412/udp \
   -p 32413:32413/udp \
   -p 32414:32414/udp \
 --network=host \
   -e TZ="<timezone>" \
   -e PLEX_UID=<user_uid> -e PLEX_GID=<user_gid> \
   -e PLEX_CLAIM="<claimToken>" \
   -e ADVERTISE_IP="http://<hostIPAddress>:32400/" \
   -v /docker/containers/plex/config:/config \
   -v /docker/containers/plex/transcode:/transcode \
   -v <localTVShowsDir>:/data/tvshows \
   -v <localMoviesDir>:/data/movies \
 plexinc/pms-docker:plexpass

Install Comskip, PlexComkip, and Dependencies:
 As pointed out by Vincent in the comments, the following should be run inside the Plex Docker container. (Thank You)

Install dependencies
apt-get install -y git build-essential libargtable2-dev libsdl1.2-dev autoconf automake libtool libavutil-dev libavformat-dev vim ffmpeg mkvtoolnix

Install Comskip
cd /tmp
git clone git://github.com/erikkaashoek/Comskip
cd Comskip
./autogen.sh
./configure
make
make install
cd /tmp
rm -rf /tmp/Comskip
Get PlexComskip
cd /opt
git clone https://github.com/ekim1337/PlexComskip.git
cd PlexComskip
cp PlexComskip.conf.example PlexComskip.conf

Edit PlexComskip.conf and change ffmpeg-path
ffmpeg-path: /usr/bin/ffmpeg

Create comskip.sh with the following content
#!/bin/sh
/usr/bin/mkvpropedit "$1" --edit track:a1 --set language=eng --edit track:v1 --set language=eng
sleep 10
/usr/bin/python /opt/PlexComskip/PlexComskip.py "$1"

Save file and set permissions
chmod +x comskip.sh

Configure Plex to use script:
Login to Plex Media Server
Click Settings
Select Server and then DVR (Beta)
Choose DVR Settings and entry  /opt/PlexComskip/comskip.sh into the Post Processing Script section.

Credits:
https://github.com/erikkaashoek/Comskip
https://github.com/ekim1337/PlexComskip.git
https://gist.github.com/hthighway/4d3567a5b4b505c3d23b93e5a7838f3e

Edit 3/15/2017: Fixed some typos.
Edit 5/6/2017: Added note about installation. (Thank you Vincent)
Edit 5/10/2017: Updated dependencies. (Thank you Gerk)
Edit 8/11/2017: Updated chmod. (Thank you Greg)

Please follow and like us:

You may also like

9 Comments

  1. Thank you so much for this 😀

    It is important to note that teh section “Install Comskip, PlexComkip, and Dependencies” is ran within the docker container.

    Else then that it’s a flawless guide.

    Vince

    1. If you stop the Plex Docker containment, Plex updates automatically when you restart it. If you download a newer container then you will have to re-setup the commercial scripts. I hope this helps.

      -Matt

Leave a Reply

Your email address will not be published. Required fields are marked *