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

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.

5 thoughts on “Converting RealPlayer .rm files to MPEG (mp4) .avi with Ubuntu”

  1. 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

  2. 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 Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>