Paul Maunders | Web log
Economics, Business, Telecoms, Tech and Gadgets

Converting RealPlayer .rm files to MPEG (mp4) .avi with Ubuntu

November 25th, 2007 by Paul Maunders

You will need mplayer and mencoder, as well as the win32 codecs in order to convert .rm files to their mpeg equivalent. So if you haven’t already got them installed you can get them with:


sudo apt-get install mplayer mencoder
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar jxfv essential-20071007.tar.bz2
sudo mkdir -p /usr/lib/win32
sudo mv -i essential-20071007/* /usr/lib/win32/

Next you need to download the realplayer feed you want to convert. First of all download the realvideo file you want and then view it to see the realtime streaming protocol (RTSP) url inside:


wget http://www.bbc.co.uk/england/realmedia/politicsshow/south/bb/politicsshow_16x9_bb.ram
cat politicsshow_16x9_bb.ram
// displays something like rtsp://rm-acl.bbc.co.uk/england/politicsshow/south/bb/politicsshow_16x9_bb.rm

Now you can use mplayer to dump the stream to your local disk:


mplayer -dumpstream rtsp://rm-acl.bbc.co.uk/england/politicsshow/south/bb/politicsshow_16x9_bb.rm

This will take as long as it would take to view the stream normally. Once it’s finished you can then use mencoder to convert the stream to your required file format. To have H264 (mpeg 4) video, and mp3 audio you would use:


mencoder stream.dump -o bbc-politics.avi -ovc x264 -oac mp3lame

You can get a list of all supported formats with mencoder -ovc help.

Posted in linux, ubuntu

4 Responses

  1. Paul Maunders | Web log » Blog Archive » Real media to Xvid (divx) and cropping with Ubuntu

    [...] you liked my last post on how to save real player streams and convert them to mpeg 4 avi files, then you might find this post [...]

  2. Paul Maunders

    As of Ubuntu Hardy you can install all the codecs and tools you need via apt-get. Just make sure you have enabled the Medibuntu repository first.

    See these two posts for more details:

    http://www.ubuntu1501.com/2008/04/medibuntu-for-hardy-heron.html

    http://www.ubuntu1501.com/2008/04/easy-media-codec-installation-for-hardy.html

  3. Paul Maunders

    With newer versions of mencoder you also have to specify at least one x264 encoding option (qp, bitrate or crf). Otherwise you get an error like “no ratecontrol method specified”. The following should work

    mencoder stream.dump -o test.avi -ovc x264 -oac mp3lame -x264encopts bitrate=256

  4. Edd

    Thanks for trawling through the manpages so we don’t have to! Just one suggestion, I found it easier to use the -playlist option than to extract the URL from the file.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.