Converting MP4 with subtitles for Roku

28 Oct 2015 06:37

I recently bought a HiSense Roku TV and it's awesome (I've never had a Roku device before).

The problem is that even though the TV has an USB port and Roku has a "Roku Media Player" channel that allows you plan video and audio files from the USB disk, not all formats are accepted.

Interestingly Roku has support for subtitles, but the support is quite limited. I found out that one of the options that work nicely is to have the subtitles embedded into the movie itself, given the movie uses Matroska container (.mkv files).

On a side note, if the files are not encoded "properly" (Roku only supports a selection of video and audio codecs), you'll need to re-encode the video using ffmpeg or avconv, but how to do it is much simpler to Google than how to deal with the subtitles. In this post I'll only show you how to deal with the subtitles.

So let's see what we have:

quake@quake-laptop:~/movies$ ls
movie.mp4 movie.txt

There's a MP4 file and subtitles in a separate file.

quake@quake-laptop:~/movies$ avconv -i movie.mp4 -f microdvd -sub_charenc cp1250 -i movie.txt -c:v copy -c:a copy movie-with-subs.mkv

Let's look at this command part by part:

  • avconv — the tool we're using
  • -i movie.mp4 — the movie to convert
  • -f microdvd — format for the subtitles (this part is actually optional)
  • -sub_charenc cp1250 — the encoding of the subtitles (optional if UTF-8)
  • -i movie.txt — the subtitles
  • -c:v copy -c:a copy — copy the audio and video stream (rather than re-encode)
  • movie-with-subs.mkv — the output file

Which is very nice is this command will not do any re-coding, it will only repackage the movie from MPEG to Matroska container and convert the subtitles. This means there's no quality lost and it only takes a few seconds.

As noted above if the file is not playable on Roku (or there's audio missing) you may actually need to transcode the file (omitting or modifying the -c:v copy -c:a copy line).

Comments: 1

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License