This project leverages docker-compose to create a service that provides PLEX media system and a post-processor that will mark and/or remove commercials from DVR OTA recordings, as well as transcode them to high-quality h.264, and reinserting them into the PLEX library.
This project leverages docker and docker-compose to create a service of two containers:
- The standard plexinc/pms-docker:plexpass container, modified by injecting a postprocessing script (in src/plexpost)
- My plexpost container, which detects new recordings and processes them with:
- Commercial Detection, marking, and/or removal
- Transcoding to H.264.
If you are familiar with the docker-compose system (recommended reading), you will see a volume created called postdata. This volume is mapped by both containers (plex and plexpost). When the plexpost container starts, it will copy the postprocessing script to a bin directory inside the postdata volume. Using the defaults, the postdata volume will be mapped/mounted inside both containers at /postdata. Thus, the postprocessing script will end up in /postdata/bin/plexpost.
This mechanism also ensures that the plexpost container can be updated separately from the plex container. For example, to upgrade the plexpost container without affecting the running plex container:
$ docker pull mbrown/plexpost:latest $ docker stop plexpost $ docker rm plexpost $ docker-compose up -d
The postprocessing script, run after every recording, will create an entry in the postdata volume. Using defaults this can be seen from either container at the path /postdata/queue. The plexpost container scans the queue folder every QUEUETIMER seconds and launches the actual postprocessing tasks as it finds new jobs.
In addition to the official plex:plexpass docker image, i'm leveraging components from other contributors. Many thanks to these for the fantastic work they have done, without which this project would not have happened.
- comskip by Erik Kaashoek - Donations Recommended
- The comchap/comcut scripts by Brett Sheleski
- The Famous HandBrake
- Create a directory to hold the docker-compose.yml and mapped data (e.g /docker/data/plex)
- Copy the docker-compose.yml file below into the directory.
- Modify the ADVERTISE_IP to match your host's IP address
- Get a Plex Claim Token and set the PLEX_CLAIM variable to this token. This is only needed the first time you run the container; once the data is initialized, it will be ignored. Once you see "Token Successfully Claimed" in the logs you are good to go.
- If you are running a firewall, make sure all the ports listed under ports: are opened
- Start it up (docker-compose up -d)
- Browse to http://your-host-ip:32400
- Configure Plex to your liking:
- If you were already a PLEX user you can migrate your PLEX configuration. In the example dockerfile, the PLEX Library folder needs to go in the subdirectory ./data below the docker-compose.yml file.
- You do need to be sure to set the postprocessing script location in PLEX to: /postdata/bin/plexpost
- Refer to the plex container documentation for details on configuring the plex container.
- After configuring your DVRs make sure you set the post processor to /postdata/bin/plexpost