Plex DVR in Docker with Commercial Stripping

UPDATE 11/27/2017 –  Plex version (Plex Pass required) has been released and  it includes the ability to remove commercials without using these scripts. ( Settings > server > live tv & dvr > dvr settings > remove commercials ). I have not tested it, however you might give it try before following these steps.

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.

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

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 \

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://
cd Comskip
make install
cd /tmp
rm -rf /tmp/Comskip
Get PlexComskip
cd /opt
git clone
cd PlexComskip
cp PlexComskip.conf.example PlexComskip.conf

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

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

Save file and set permissions
chmod +x

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/ into the Post Processing Script section.


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)

16 Replies to “Plex DVR in Docker with Commercial Stripping”

  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.


  2. Thank you.

    Yes, you are correct. I updated the post to make this more clear. Thank you.


    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.


  3. Can I run this without a docker? I just have Plex server installed on Linux Mint 18.2 (base is Ubuntu 16.04) and I am looking to get a commskip and converter to run on my DVR recordings from Plex… I’m no master and would love to make this work!

  4. First off, thanks for the guide! I’m having an issue where when Plex puts a “;” in the filename, the breaks saying it “can’t open the file”. Do you know of a setting, or another SH I could run to rename the files first?

    1. Looks like I had one too many beers, it wasn’t the “;”, but a permission issue on the folder. I can now manually invoke, and it works wonders! The auto-run from Plex is still failing, not sure why…

      1. You can delete these in moderation if you want, I found my issue. I’m not running this in Docker, so the path to the file had to be entered differently into Plex for it to find it. Now it’s running like a dream, you sir are awesome!

        1. Sorry I have been away and missed your comments. I am glad you got it working.

          I will leave your comments, if you don’t mind. Maybe someone else will find them helpful.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.