Friday, May 25, 2012

Embedding UTF-8 Subtitles

I recently spent hours trying to work out how to get hard coded subtitles into a video file so I could upload it onto youtube.

The video in question was made with Cinelerra on Ubuntu. This program is very powerful, but an absolute pain to use. Annoyingly I was unable to get it to recognise UTF-8 chars in the subtitle text I wanted to embed, so I had to look elsewhere.

Instead, I created an SRT subtitle file with the Linux program Subtitle Editor. I tried several programs, Avidemux and others, to embed this into the video. All of them failed to recognise the extended character set.

In the end I had to use Handbrake to embed the subtitles. However it was not all easy sailing. Handbrake would embed my SRT file happily, but only as a soft subtitle (meaning it was an option dependant on the user's preferences). Unfortunately, when I uploaded the file to youtube, I could not include the subtitle file.

So, back to the drawing board.

Strangely, although Handbrake allows hard encoding through the checkbox 'Burned in', this option was disabled for SRT files. It is only allowed for SSA files. I went back to Subtitle Editor and saved the file in SSA format. Then I discovered that handbrake would not let me open an SSA file to embed it.

After an afternoon of frustration I discovered I could use handbrake to create an MKV file of my movie, and then use mkvmerge to embed the SSA file in the MKV movie. I could then open the new MKV file in Handbrake, at which point I was able to select the SSA subtitles and choose the 'Burned in' option to make them a permanent part of the video.

If this does not make you want to jump out of a window, then you have a higher tolerance for absurdity than I do.

No comments:

Post a Comment