- A working MythTV backend setup
- HandBrakeCLI installed.
- To install on Ubuntu, try: sudo apt-get install handbrake-cli
- Your MythTV database username and password:
- You can find these under /etc/mythtv/config.xml
- Add these to the DBUSER and DBPASSWD lines in the script. Keep quotes.
Script functions:0. Invoked as a user-job after a MythTV recording completes
1. Query database to check if invoked for a commercial-free channel
2. If commercial-free channel, go to step 7
3. Flag commercials using "All" methods, copy flagged commercials to cutlist
4. Lossless transcode to remove commercials from the file
5. Rebuild the seek table. Clear cutlist
6. Update database to point to recording with no commercials
7. Remove stale bookmarking and seek information from the database
8. Use Handbrake to transcode recording to H.264 (MPEG-4):
-- preserve original audio track (5.1, dts etc.)
-- preserve subtitles
-- Use x264 encoder for HD-quality video with much reduced file-size
-- deinterlace video if necessary
-- create .mp4 file format compatible with Roku or Apple/Android devices
9. Update database to point to the new .mp4 transcoded file
10. Rebuild seektable for new .mp4 transcoded file
Download and install:0. You can download the script here.
1. Change the DBUSER and DBPASSWD lines in the script to match your settings.
2. Save the script (as root) to /usr/local/bin
3. Invoke mythtv-setup and navigate to the user-jobs section.
4. Provide the 4 arguments required for the script: %DIR% %FILE% %CHANID% %STARTTIMEUTC% as shown below:
5. For a new recording schedule via Mythweb, select the name of the user job you just added:
6. You should see the job launch after the recording with a "T" icon under "Recorded Programs" in Mythweb, indicating that the file has been transcoded: