Looking back at this effort I put in to try transcoding, while it worked…why did I care?
So I save some GB on my TV show recordings. 99% get deleted after watching anyway. So with no transcoding, my shows are ready minutes after recording (just comskip stuff) or quite a long time later if transcoded.
I appreciate this is an old thread but I was interested in your comment about Plex now creating .mkv rather than.ts files from build 1.7.0? I am on build 1.18.1973 and my HD Homerun Coonect/Plex combo still records in .ts?
Fozzie
i ran into the same issue while using different paths within the script.
My hint for you is to put the HandBrakeCLI.exe, the batch file and the json into the same foder.
After that it was working for me.
Handbrake starts as an background process, is doing its work and give the new file to Plex.
Plex is searching the right folder in your libary and will put it there.
You can have Plex recognize ts files by doing the following. I have all my over the air recordings from my HD Homerun placed into my “OTA_TV_Shows” directory. Once you add that directory to your Plex library you’ll notice Plex adds a “.plexignore” file in the root library directory. On my machine it’s located at “OTA_TV_Shows.plexignore” . Open this file and you’ll notice the 2nd line is “*.ts” either delete this line or comment it out (using a ‘#’).
After editing go rescan the directory and Plex will recognize ts files automatically.
For more information on why Plex does this you can here or here
I also happened to notice that in version 1.18.X (not sure when they put it in) there is a labs feature that allows you to transcode on the fly from my HD Homerun. You can get to it by going to settings --> Live TV & DV which bring up your HDHomeRun Connect dialog. Selecting “Device Settings” gives you an option to “transcode”. I just turned it on so I’m not sure how well it works. Upside is less space taken up but the downside is CPU overhead. Not sure which method (transcode or allowing ts file types) I’m going to go with.
I know this thread is a bit old but I was able to use a modified version of the script above with FFMPEG to get Plex to convert .TS to .MP4, also shrink the file size significantly and finally deletes the .TS file once it converted.
This works exactly how I want it, my Plex DVR records and Plex calls the batch script after recording which does everything at once.
Saved this 2 line script in a postproc.bat file that was to be called by plex after every recording
Then in the DVR Settings I added this simple line in the PostProcessing Script
<batch file folder>\postproc.bat
I didn’t want to install another program and simply just downloaded the latest FFMPEG build.
The conversion was pretty fast and the output was going from 2Gb to 350MB as I also included in resize which goes a long way in the conversion file size.
And with time comes changes… Here is mine that adds in comskip data (here’s hoping that maybe Plex will one day add EDL support!) via .ffmeta as chapters. This allows you to ‘skip’ commercials as opposed to editing them out destructively.
In addition, this version uses QSV Hardware decoding and encoding during the process, converting to h.264/AAC in an MP4 container.
::run Comskip which will output ffmeta file
::Ensure your comskip.ini has output_ffmeta=1 specified
CALL "C:\Program Files (x86)\Comskip\comskip.exe" %1 --ini="C:\Program Files (x86)\Comskip\comskip.ini"
TIMEOUT /T 5 /NOBREAK
::run ffmpeg to remux and/or convert to h.264/AAC in MP4 container.
::Use h264_qsv to utilize Hardware encoding and speed up the process.
CALL ffmpeg.exe -hide_banner -hwaccel qsv -c:v h264_qsv -i "%~dpn1".ffmeta -hwaccel qsv -c:v h264_qsv -i "%~dpn1".ts -c:v h264_qsv -b:a 160k -b:v 10M -bufsize 1M -profile:v main -global_quality 22 -preset veryfast -movflags +faststart "%~dpn1".mp4
TIMEOUT /T 5 /NOBREAK
::Delete original .TS and .FFMETA file
del "%~dpn1".ts
del "%~dpn1".ffmeta
Thank for your recommendation on MCEBuddy! I see exactly what your saying with your tips. For me MCE doesn’t put the converted file in the same sub folder (even though destination file is the same as the source folder) Therefore not only do you lose the metadata, Plex no longer recognises the new version as it doesn’t have season or episode number ref.
Also I have recorded tv and recorded films that I would like to convert respectively (similar to your last paragraph) but i cant figure out how to do that without merging the output folder.
Can you offer any further advice? thank you
For each task, you have a destination folder - if you leave that blank, you can drag and drop the directory into MCEBuddy - it will grind through and then dump the transcoded file back in the original location. You can also turn off all the renaming and metadata collection / adding in MCEBuddy - that will both speed things up and not confuse Plex. The renaming options are under Advanced Settings. You can also define your custom naming scheme if you really want to, but it’s not necessary as Plex names it appropriately to begin with.
I believe that Plex has changed their metadata service so that it ignores the extension - I’m not seeing the loss of metadata when it converts from .ts to .mkv.
What I do need to do is turn up the frequency of the library scan so Plex updates its reference to the media file - 15 minute lag isn’t great, but it’s doable. Good luck!
I just ordered a Homerun DVR and like the simplicity of this script. Do you still use this script, and have you thought of removing commercials with it?
I’ve got two HDHomeRun Primes. I had used the script above to post process the file. When Plex broke commercial skipping (or at least commercial cutting) as of 1.18.6.x, I stopped using the post-processing script in favor of using MCEBuddy to monitor different library locations.
Depending on where the recording is in the filesystem, it either removes commercials or not. Hopefully Plex fixes that sometimes soon - while my fallback approach works, it adds an extra 15 minutes of time between the recording being processed by MCEBuddy and the library indexer to pick up the newly encoded MKV.
Thanks. I got my Homerun in the mail today and set it up. Tested out MCEBuddy and after playing with it I found it does everything I ever wanted. This has been a great help and all of my questions have been answered.
MCEBuddy is the best way to go unless you need something extremely custom.