Wednesday, September 23, 2009

Start your Mediatomb transcode where you want!

One issue with using Mediatomb and transcoding to watch videos on the PS3 is that, if your network cuts out, the video stops, and you have to start all over again. Oh yeah, and Mediatomb doesn't support fast-forwarding for transcoded files.

Luckily, both programs I've been using to transcode support a "start offset" setting. For VLC, the commandline flag is "--start-time" and for mencoder it's "-ss".

Sure, we could edit our transcoder script every time we want to start somewhere other than the beginning, but that's a pain in the butt, especially if it's in a write-protected directory and you have to sudo.

So, what I did in my mencoder transcoding script (See the last post I made, or go here: was try to load a file that contains a number -- the number seconds we want to delay start. This can be any file, so long as you make your transcode script point to that file.

To populate this file, I threw together a quick script. You can put this anywhere, particularly /usr/bin if you want to be able to run it easily on command line. Mine's just in my home directory for now. The script takes a single argument, which is the number of minutes to offset start. It accepts a decimal number as well, so you can do .5 for 30 seconds, etc. Anyway, here it is:

Make sure the variable OFFSET_FILE at the top points to the same one that gets read by your transcoder script! Also, you may need to make sure that you have "bc" installed for the floating point math.

If you put the script in /usr/bin/mediatomb_delay, then you can run it easily like this:

mediatomb_delay 55.5

This will tell mediatomb to start transcoding from 55 minutes and 30 seconds.


No comments:

Post a Comment