Is there a way to run ffmpeg to re-encode the DVR contents with h.264 before it goes into Commercial Skip analysis? Is Commercial Skip modifying the data file or is it storing the start/end times in another way?
The tuner setting āCONVERT VIDEO WHILE RECORDINGā will encode on the fly to h.264 but like it says you need a strong CPU. Passmark of 2000 per active stream.
Commercial detect and skip scans the file after recording and stores the skip points in the database. Detect and delete cuts the segments from the actual file after the recording.
Their is a DVR setting āPOSTPROCESSING SCRIPTā that you can use if you want a customized script that will use the GPU. Little documentation though.
Iāll have to record something while we have 2 streams playing. The Roku clients dont require any video transcoding done on the server so I doubt PMS will have any problem with it.
Maybe someone will chime in on using POSTPROCESSING SCRIPT with ffmpeg using a NVidia GPU.
I use MCEbuddy on Windows for this. It monitors the TV folder for any .ts files, cuts commercials, then re-encodes to H.265/MKV. I know the files recorded from HDHomerun are already compressed (Iāve got the one that has built in hardware compression), but itās just DVR content Iām not concerned with quality.
Bonus with MCE, I can use custom INIs to help tune how it cuts certain shows or channels. I specifically cut the commercials from the file (not just marked), so if I notice something off I can go back and try a different INI file as the originals are archived.
You donāt need to use the post-processing option at all. Instead, you can set up a job to run in cron at a regular interval and have more control over when things happen (like the wee hours of the morning if you donāt want to run conversions during your normal viewing hours, for instance)
Things you should consider doing if you go this route:
Create two new libraries to hold your dvr recordings. One for movies and one for shows.
Plex will not put the recordings into their final destination in the libraries until after recording is finished. Instead, it creates hidden directories (.grab at the ārootā of your library directory) while the recordings are in progress and it moves the recording into its final destination after the recording is finished.
Have your script (launched by cron) check for files in the dvr libraries you just created and, when it finds a new file, run your conversion. Write the output to a work directory. Depending upon how many recordings you do and how often you schedule your conversions to run, you should probably also consider adding a check for running copies of your script so you donāt end up running two at once. This is generally done by writing out a āpidā file and having your script check for running copies when it first starts up. (i.e. āps -p ${pid} -fā and check to see that the job that is running is named the same as your scriptā¦)
After the conversion is complete, move the converted file out of the work directory to your permanent library (wherever you are currently recording to, most likely) and move the ts file in the dvr library to a directory plex cannot see (or remove it, your option). Moving it would allow you to restore the original recording in all of its glory or allow you to perform another conversion using different settings. I hold onto them for a little while and then delete them with a maintenance script (yet another cron job) before they fill up my filesystem.
If you are recording new shows only, you probably donāt need to do anything else in your script. If you are recording repeats then you can add a check for the converted show in your permanent library before running the conversion step and, if you find one, you can just move (or remove) the ts file as in #4 above. (This is where a pre-recording option in plex would come in handy since it would allow you to check for the show and tell plex to skip the recording if it already exists but, alas, no such option exists.)
Note: Plex will own the files and directories in the ārecordingā directory and it will set the permissions as read-write for plex and read-only for other accounts. Itās not a good idea to mess around with the plex account (itās set up as no-login) so the easiest way around this is with a second cron job run as root that recursively changes the permissions of everything under your dvr recording directory. Doing that will allow you to run the conversion using any account you want (or, more specifically, do the cleanup of the directory after the conversion is finished).
I havenāt spent any time figuring out how to run the commercial scanner after the conversion is complete but I did see it running (before I turned that option off). Basically, it is the paid version of comskip but it has been renamed. It shouldnāt be that hard to figure out, though. Turn it on in the options, wait for a recording and then keep running ps until you can capture the command line. Then, turn it back off (because why would you want to mark commercials in the copy you are ultimately going to move/delete?). Once you have that, you should be able to add it to your scripting after the move to your permanent library is done.