Streaming media with Mediatomb

Aug 25, 2010 00:18

Do you have anime/videos/tv shows sitting on your computer and a ps3 (or a device from this list, though theoretically any uPnP player should work) and a linux server (really, do people NOT have a linux server kicking around?)  and the desire to watch your videos on your television?  Well then mediatomb may be the answer you're looking for!

Mediatomb is an open source uPnP streaming media server that supports transcoding content on the fly.  So with a little wherewithal you too can watch your 1.2T of anime on your tv!  (What, you DON'T have 1.2 terabytes of anime?).

If you've setup a Linux box before/are able to install packages on your chosen distro you should have the skills required to setup mediatomb

Anyway, just wanted to point out this incredible useful piece of software and share my mencoder line in the transcode script (this stuff was the only part that wasn't very well documented...anywhere).

mencoder "$input" -oac lavc -ovc lavc -of mpeg -ofps 30  \
            -lavcopts vcodec=mpeg2video:vbitrate=5000:acodec=ac3:abitrate=448 \
            -lavfopts muxrate=2000 \
            -vf scale=1280:720,harddup -alang "$alang" \
            -slang "$slang" -font 'Bitstream Vera Sans' \
            -subfont-text-scale 2.5 -subpos 95 -subwidth 90 \
            -o "$output"

Now beacuse I'm a masocist I'm going to try to explain all the options, or at least why I chose them.  The first is just the input file from the script.

-oac tells mencoder to use the ffmpeg output audio module (libavc)
-ovc tells mencoder to use the ffmpeg output video library (libavc)
-of tells mencoder to write out an mpeg2 container
-ofps 30 tells mencoder we want to write out at 30 frames per second (required for mpeg2)
-lavcopts (libavc options)
vcodec: use mpeg2 video codec
vbitrate: video bitrate (Higher numbers = higher quality, but obviously can't be higher quality than the input file, aka bitrates higher than the bitrate in the input file won't produce higher quality video, also mpeg2 has limits on the range, believe it is 1.5-5mbps)
acodec: use the ac3 audio codec (specified by the mpeg2 container standard)
abitrate: required bitrate specified by mpeg2 standard
-lavfopts muxrate: this option I use to help control buffer underflows (From mencoder man page), when I get buffer underflows the image on the screen freezes...so I have to restart the video!
-vf video filters: scale to 1280x720 (this is what looks the best on our tv, and prevents the tv from trying to stretch it, which yields...hideous results)  and you must use harddup when changing the video framerate (I used to know why, but I've forgotten O.o, I believe it has to do with allowing duplicate frames)
-alang and -slang the 3 letter iso code to set default audio and subtitle streams (script params)
the rest are self describing subtitle options!

Anyway, mediatomb is a great way to watch anime using your ps3/uPnP media player, vixen and I have been using it for a few years now and we're (mostly) happy.  Just be careful, using the transcoding computer too much can yield studder-y video.  The buffer underflow problem was really annoying, but upping the muxrate does help..I just wish I knew why.

Also, if the worst should happen the -ss hh:mm:ss command line option to mencoder allows you to skip to the time specified (frames are still decoded).

Finally, unless you watch all the way to the end you'll end up with zombie mencoder processes that you'll have to go through and kill from time to time.

streaming video, linux, tech, mediatomb

Previous post Next post
Up