From eBower Wiki
Jump to: navigation, search

I've been a long-time Plex user, but it's been largely polished and not in need of documentation. However their new DVR solution has some quirks in that it's the first time I need to write to a directory.

Basic Information

First, you currently need to be a Plex Pass membership. Take a look at whether this would enable you to cut the cord with your cable company; if so a lifetime pass will pay for itself in a short timeframe. I took a look at the effort I expended in getting a MythTV setup working, realized how often I'd likely need to rebuild the system as devices evolve, and the time it takes to transcode (or re-rip) my library and quickly found that my time was worth a lot more than the cost of Plex Pass.

First, you'll want to read the FAQ for DVR support. It has links to the proper download version as well as the supported hardware. You'll also want to check out the DVR Beta forum for support.

The supported hardware started with just SiliconDust but has expanded to a wide variety of devices. I opted for the HD Homerun EXTEND based on the premise that an onboard transcoder to a lower bitrate stream may be of some level of benefit in the future, but the CONNECT should work just fine as well.

Library Permissions

One option is to create a dedicated DVR directory. For example, I use /mnt/movies and /mnt/tv_shows. A trivial solution is to create /mnt/dvr/movies and /mnt/dvr/tv_shows with different permissions owned wholly by Plex. I use this method ow to segregate content that I own on DVD from stuff that's from the DVR and other sources.

Group permissions are the key to this solution. I want to be able to write to a directory, but I also need Plex to be able to write to it. As such, I created a media group and added both myself and the plex user to it.

sudo groupadd media
sudo usermod -a -G media plex
sudo usermod -a -G media $USER

Unfortunately Plex forces permissions onto the new files it creates and those permissions are 644, meaning members of the plex group can't edit or delete files. You can fix this periodically using a cron:

sudo su plex
crontab -e
00 * * * * find /path/to/library -type f -exec chmod 664 {} \;
00 * * * * find /path/to/library -type d -exec chmod 775 {} \;

You can also tack these onto the end of the postprocessing script (see Commercial Detection and Removal below).

Samba permissions

Samba allows us to force user/group ownership and permissions. First we'll want to ensure that the directory is writable in the /etc/samba/smb.conf configuration:

   comment = Movies
   path = /path/to/movies
   guest ok = no
   writable = yes
   browseable = yes
   valid users = your_username, plex
   force group = media

In the Plex server's /etc/fstab you should have a line like the following:

//samba-server/movies /mnt/movies cifs credentials=/etc/smbuser/plex,_netdev,noauto,defaults,noperm 0 0

The /etc/smbuser/plex file is very simple:


If course, you'll want to sudo chmod 600 /etc/smbuser/plex and not use a very important password here.

Where's the Grid View?

There isn't one. And really in the current state, you don't need it. The grid view is there to help tie you to the stations that are broadcasting a show, but really it's awkward. Let's take a look at NBC's Tuesday night lineup (network and day chosen at random). We start at 8:00 with a game show, then go to a drama/comedy, then a first-responder drama. There is absolutely nothing to tie these shows together other than the setting on your tuner.

Instead, you just search. Let's say you like crime procedurals, search for Law and Order and start recording. Search for CSI and pick a series. Now you can look in the Program Guide and you notice that Chicago Fire is in your Recommended For You section. This is much cleaner, you don't need to know that it's NBC who's airing it or that it's at 10pm on Tuesday - that's all hidden in the back end.

With live TV things change a bit. There's an "On Right Now" and "Starting Soon" section, but that would be a bit easier to view in a table format. However, I wouldn't want a table with the channel as the Y axis, instead I'd rather see all of the sitcoms that are airing now and for the next few hours without caring about which station they're on - effectively showing me a tuner scheduling diagram with time on the X-axis and a filter by genre or name. This way I don't need to worry about trying to ignore a game show on a station but needing to pay attention to what's on next I can browse by content instead of by channel. I also find that Plex's recommendations based on your library content are reasonable.

Additional Plugins

Some useful plugins for Plex:

  • Tautulli provides a slick front end for seeing who's streaming on your server. It includes various notification plugins that can replace PlexWatch for my needs.
  • Plex WebTools is an installer for various plugins that can make management and upgrades easier.
  • PlexUpdate can keep your server up-to-date, but it's possible that Tautulli can replace it as well.

Commercial Detection and Removal

Software called Comskip can detect commercials in DVR files with varying degrees of success. You'll need to first install dependencies, then download it from GitHub:

sudo apt-get install git autoconf libtool libargtable2-dev libavutil-dev libavformat-dev ffmpeg libavcodec-dev
git clone git:// 
cd Comskip
sudo cp comskip /usr/local/bin/

This just detects commercials, to remove them you can use the comcut and comchap scripts:

git clone git://
cd comchap
sudo cp comc* /usr/local/bin/

Using comcut filename.ts you should now be able to remove commercials and overwrite filename.ts with a commercial-free version. Needless to say, if the content is important to you this may be a bit scary, so you may instead wish to use comchap which will do the same, but instead add chapter boundaries at the commercials for easy skipping.

To enable this automatically, just go to the Plex web UI, Settings -> DVR, then click DVR Settings. There's an entry for Postprocessing Script which can be changed to "/usr/local/bin/comcut" (or comchap if you're more comfortable with that).

For me the reliability is too variable based on the source channel, the major networks seem to be reliable but some of the stations showing older shows not so much. As such, I've created a plex-post wrapper script which allows me to treat each show differently. By default it will copy the original file to the library prior to trying to cut out the commercials. But I can specify shows that use comchap instead or that save me the hard drive space and avoid the copy. Some shows are also commercial-free and rather than risk a processing artifact I just skip the post processing step altogether.

Unsupported Hardware

It may be possible to use unsupported hardware by using Tvheadend and the Tvheadend proxy. I haven't tested this myself, nor would I recommend you buy hardware hoping it will work, but if you've got a tuner already it could be worth playing with.

Custom Cert

This may be a bit specific, but perhaps useful to some. I have a webserver at, as you may have noticed. I also have which redirects to the Plex port at But I can use certbot on the server to create a cert for pretty easily. However, Plex doesn't allow for this to work directly. Instead, I need to follow these steps:

  1. On the webserver, do a sudo su and change to /etc/letsencrypt/live/
  2. Run openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out plex.pfx -name "Plex key". This will prompt you to add a password - use a strong one.
  3. Copy this key to the Plex server at someplace like /etc/ssl/plex.pfx.
  4. Run sudo chown plex:plex /etc/ssl/plex.pfx on your Plex server.
  5. Under the Plex settings click on Server, then Network on the sidebar, then click "Show Advanced" near the top.
    1. Add the path to the key (/etc/ssl/plex.pfx) under Custom Certificate Location.
    2. Add the password to the key under "Custom certificate encryption key"
    3. Add the DNS name to your server under "Custom certificate domain"

You may need to restart your server and browser for things to work, but this should remove the cert warnings.