Wednesday, September 23, 2009

Mediatomb + Mencoder

In my previous post on Mediatomb, I was using VLC to transcode the videos with the subtitles attached. This works the vast majority of the time, but sometimes the subtitles contain non-standard symbols, such as the curly quotes (They are the ones that are curved inward toward the text, unlike the standard quote symbol which is strictly vertical; I'm not sure what these are actually called) or an ellipses character, that you might see when using Microsoft Word. Unfortunately, VLC doesn't seem to support these characters (at least, my version doesn't) and instead of silently ignoring them, it leaves off any line containing them. Consequently, some shows end up with lots of un-subtitled parts, which can be a problem if I watch a Korean show, for example, as I don't know much more than the very basics.

What I'd been doing was using a script to temporarily strip out these characters into a separate file, keeping a copy of the original to be replaced fifteen or so seconds later, once the fixed file had been read. This works pretty well, but then of course you're often missing quotes, apostrophes and ellipses. Furthermore, this also sometimes failed miserably, resulting in the subtitle file being completely erased. In addition, I came across several videos that VLC simply refused to play.

My solution? Switch to mencoder. It was temporary at first, but now that I've uncovered the subtitle options and gotten them to display as I like, I'm much happier. So far, I've had no problems with videos not getting playing, and it even reads the characters that VLC choked on!

Enough talking, let's get down to business!

I got started with the guide here: http://psyklops.blogspot.com/2009/01/mediatomb-and-ps3-with-mencoder.html

The problem is that mencoder didn't seem to want to load my subtitle files automatically. Fortunately, I'd already written a bash script to find the subtitle file for a video (It's brute force, but it works), so I was able to simply throw it in. Even if the subtitle file isn't found, mencoder doesn't complain, so the same transcode script works even if there are no subtitles!

I wasn't able to find all the subtitle options on the mencoder website, but you can see them here: http://linux.die.net/man/1/mencoder

Another thing that's changed from my old post is the start offset. I forgot to update the old post, but I wrote a quick script that saves the offset into a file, which gets read when the stream starts and deleted later so you don't have to worry about it. I'll post about that next. If you want to use it, make sure to replace the /home/YOURNAME/ with the path to your home directory!

Here's my /usr/bin/mediatomb-transcode-video:
(http://pastie.org/627856)

No comments:

Post a Comment