OTA TV to Plex - Part 2
Well, that's not great. Saving the OTA streams as a MPEG-2 Transport stream (.ts file) means that my 1 hour NOVA episodes are going to be 4+ Gigs a piece. That's not really efficient, and I didn't have the storage space to store the a large amount of episodes at that size.
So the next major problem I needed to tackle was that I needed to convert the "raw" MPEG-2 stream files into a more appropriate format, for both storage and streaming benefits. My first thought was to write a script to manually loop over the recorded directory and run the files through ffmpeg to transcode them into a H.264/HEVC format. Which worked right up until I ran into my first recorded re-run.
Re-runs presented a problem in that a) I already recorded the episode and thus didnt need another copy of it and b) the new copy would likely be better quality then the old copy due to the current shift in OTA from SD to HD digital signals. So how do I keep only 1 copy, of hopefully ever increasing quality?
To handle this I originally wrote a script that after the transcoding's complete, it checks the new file size against the old file size, and keeps the larger of the two. The script can be seen on Github. The script worked for a couple years on a timer that ran once a day. Though it does have its faults, as the bigger file is not always the better file. Plex is not 100% on commercial detection, or the TV schedule gets shifted due to overtime on a sports game, both can lead to substantially larger files then the expected size. So you still have to go in a curate your Plex library to make sure you are actually getting the best, and not just garbage.
The system worked well enough, until I setup a local k3s cluster. At which point I had to modify it to be better ( read "modify it to leverage the new shiny thing"). And that's when I loaded up Tdarr.