Enhancing my TV Viewing Experience

In my last post about TV viewing, I wrote that I’ve switched to MythTV with a few custom scripts to export to Plex. This setup has been working well and I’m quite pleased with Plex on the AppleTV. One of the features of the AppleTV 4 is the ability to ask Siri things including “What did he say?” where the video rewinds a few seconds and turns on subtitles. This is an extremely useful feature that we’ve used a number of times watching shows on Netflix. However, since I have my own system for recording/watching shows, I didn’t have the ability to do this.

So, I decided to see what it would take to enable this. From what I read, Plex will show subtitles and if the subtitles are in the video container itself (i.e. in the mp4), it wouldn’t require extra processing power on the Plex Media Server to show the subtitles. That got me thinking that if I could turn the closed captioning into subtitles and put them in the mp4, maybe I could get this feature working.

Using the ever so powerful ffmpeg, I figured out that to extract the closed captioning (closed captioning isn’t the same as subtitles as far as I can tell as they are transmitted differently) using this:

/usr/local/bin/ffmpeg -f lavfi -i "movie=${TEMPDIR}/${FILENAME}[out0+subcc]" -map s ${TEMPDIR}/${FILENAME}.srt

Where ${FILENAME} is the MPEG2 file with the commercials stripped out (otherwise the titles wouldn’t match up).

Then I could use this:

    /usr/local/bin/ffmpeg -i ${TEMPDIR}/${FILENAME}.mp4 -f srt -i ${TEMPDIR}/${FILENAME}.srt -metadata:s:s:0 language=eng -c:v copy -c:a copy -c:s mov_text "${PLEXDIR}/${TITLE}/${OUTPUT_FILENAME}"

Which merges the newly created subtitle file (.srt) into the mp4 file.

After doing all that (it takes awhile to do the processing), I had an mp4 file with subtitles in it! I tried it out in QuickTime Player, turned on subtitles and show words. Next I put the video into Plex and played it through the Plex interface; good there as well. Now the last test was to play it through the AppleTV and use the Siri command to find out the last words. Amazingly that worked as well! There was a slight hiccup with Plex where the video stutters after the subtitles are turned off, but that’s pretty minor.

Putting that all together, I updated my plexexport script that I call from MythTV. While this whole setup has taken a little bit to get running, I just smile every time we watch shows as it really works seamlessly and requires no babysitting (I do check on the recorded shows each morning just to make sure that nothing went wrong, but that’s just because I can’t believe it really works!).

The TiVo works wonderfully for the average user; I’m not the average user and I consider all this work a hobby. Will I get tired of putting together my own systems like this? I have no idea, but for now, I’ll keep working on it until it is perfect (this system is almost perfect, but I’m sure there can be more).

2 Replies to “Enhancing my TV Viewing Experience”

  1. Scott

    You are blowing my mind! I can’t wait to try this! It may be just beyond my technical abilities but I’m willing to give it a try.

    Thanks for the sharing this!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.