Tvheadend Post Processing with Commercial Removal, Transcoding, & Plex/Kodi Naming Convention
Bash Script is located here:
- Comskip Linux port from here: http://forum.kodi.tv/showthread.php?tid=150084
- HandBrake CLI
- xmllint (libxml2)
- mc2xml setup with TVHeadend as instructed here (https://tvheadend.org/boards/4/topics/10322)
- Possibly more I’ve forgotten…
This is a post processing BASH / Shell script designed for use with Tvheadend (tvheadend.org) to scan for commercials, transcode to H264 & cut commercials from the H264 file. The script also uses the xmltv output of mc2xml to name recordings for Plex/Kodi(XBMC) to scrape properly.
Future Goals of this Project are:
So I’ve had some personal requirements changes. One of the problems with the way this is written is that it fires off post processing immediately regardless if one is already processing. This works for the first few but after 3 or 4 are processing at once recordings start to suffer pixelation and processing speed is brought down to a crawl. Not to mention that even with one running my Plex server is unable to transcode files for remote play anymore. So here’s how I’m thinking about solving these problems:
- Build a queuing system and only post-process one at a time.
- Implement a SQL database for the Queue and to replace logging.
- Run post processing on a separate system (I’m going to try using my Raspberry Pi)
- As amazing, fun and power efficient as the Raspberry Pi is… the CPU is slow… even overclocked… So I have to find a way to take advantage of the GPU Decoder/Encoder. (i.e. Comskip runs at about 200-400fps on my Intel Core2Duo and about 12fps on the RPi)
- Choosing what language to write this in. Bash may be sufficient to do the job but I know PHP much better than Bash which would give me a heads up on dev. time but would require having a server. A compiled language is always nice but a bit overkill for something that will really only be calling other executables and keeping a small database.
- Time (believe it or not I don’t have much free time, lol)
Resources I’m looking at to solve this:
http://theiopage.blogspot.com/2013/04/enabling-hardware-h264-encoding-with.html (pre-built RPi Gstreamer library with Open Max support)
https://solarianprogrammer.com/2015/01/13/raspberry-pi-raspbian-install-gcc-compile-cpp-14-programs/ (for compiling comskip which I completed)