Search:  
Gentoo Wiki

MPlayer/Rip_streams


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

The aim of this howto is to rip (i.e. save on the hard disk) audio/video streams using MPlayer.

MPlayer can handle most of the streaming formats that are used on the Internet: Real Media, Windows Media and Quicktime are the most important ones.

Codecs

Quicktime

If you want the support for Quicktime movies, compile MPlayer with the win32codecs USE flag, then issue the following command:

# emerge -pv mplayer

and check that the win32codecs package is going to be compiled with the quicktime USE flag.

Real Media

Real Media codecs are provided by two different packages: realplayer and win32codecs. By default, realplayer's ones are used due to security issues with the latter, but in my experience some streams can be correctly played only if you use win32codecs. The default behaviour can be eventually changed with a little tweak, which anyway makes things slightly more difficult. So, if you really care about security proceed with the default way, otherwise carry on with the alternative way.

Default way

This is the easiest way, as you only need to compile MPlayer with the real USE flag. Portage will install realplayer as a required dependency. Codecs will be installed in /opt/RealPlayer/codecs/ directory.

Alternative way

We need to tweak MPlayer's ebuild. Before proceeding, let's copy it and some other required files to the overlay directory. In this example, we'll assume your PORTDIR_OVERLAY is set to /usr/local/portage.

If you don't know what an overlay is or you don't have it yet, please read this howto.

# mkdir -p /usr/local/portage/media-video/mplayer
# cd /usr/local/portage/media-video/mplayer
# cp -R /usr/portage/media-video/mplayer/files .
# cp /usr/portage/media-video/mplayer/mplayer-1.0.20060415.ebuild .

Now open /usr/portage/media-video/mplayer/mplayer-1.0.20060415.ebuild with your favourite editor.

File: /usr/portage/media-video/mplayer/mplayer-1.0.20060415.ebuild

We don't need realplayer, so comment it out:

#x86? ( real? ( >=media-video/realplayer-10.0.3 ) )

MPlayer should look for win32codecs, not for those provided by realplayer:

pkg_setup() {
        if use real && use x86; then
                                #REALLIBDIR="/opt/RealPlayer/codecs"
                                REALLIBDIR="/usr/lib/win32"
        fi
}

Finally, create the digest file:

# ebuild mplayer-1.0.20060415.ebuild digest

Before emerging MPlayer, make sure it will be compiled with the win32codecs and real USE flags. You have to enable the real USE flag for win32codecs package, too.

Live.com

Since some streams need Live.com support, it is recommended that you compile MPlayer with the live USE flag, otherwise you may get an error like this:

Playing rtsp://realserver.kataweb.it/katanew/news_ansa/1099310401142_Mondo_20041101125647_low.rm.
Resolving realserver.kataweb.it for AF_INET...
Couldn't resolve name for AF_INET: realserver.kataweb.it
Not a Realmedia rtsp url. Trying standard rtsp protocol.
RTSP support requires the "LIVE.COM Streaming Media" libraries!
Unable to open URL: rtsp://realserver.kataweb.it/katanew/news_ansa/1099310401142_Mondo_20041101125647_low.rm
FIXME: rtsp://realserver.kataweb.it/katanew/news_ansa/1099310401142_Mondo_20041101125647_low.rm doesn't exist any more. Find another test movie.

rtsp://a1223.v26085d.c25708.g.vm.akamaistream.net/7/1223/26085/v0001/media2.dayportmsp.com/ccn1d/0044/21590020051205_002656p7003041p5.wmv Could be a good test movie.

Installation

This is simple:

# emerge -av mplayer

Testing

The best way to see if everything went well is to play some movies before trying to rip them. All you need is to find the URLs of some streams and launch them with MPlayer:

$ mplayer "<url>"

If you have problems you can try to add the -playlist option:

$ mplayer -playlist "<url>"

If you still can't view your video, try to use wget and cat commands. For example:

$ wget "http://www.br-online.de/cgi-bin/ravi?v=alpha/centauri/v/&g2=1&f=041027.rm"
$ cat "ravi?v=alpha%2Fcentauri%2Fv%2F&g2=1&f=041027.rm"

This will show you:

Code: $ cat "ravi?v=alpha%2Fcentauri%2Fv%2F&g2=1&f=041027.rm"
rtsp://ravi.br-online.de:5050/ravi/alpha/centauri/v/041027.rm
--stop--
pnm://ravi.br-online.de/ravi/alpha/centauri/v/041027.rm

Grab the first URL and play it with MPlayer:

$ mplayer rtsp://ravi.br-online.de:5050/ravi/alpha/centauri/v/041027.rm


Tip: If you can choose, always prefer the rtsp://, http:// or mms:// protocols over the pnm://, as the latter is not well supported by MPlayer yet. If there is only a pnm:// link provided, you can also try replacing the pnm:// at the beginning of the link with rtsp://

Working streams

Note: Some of the following streams require mplayer to be compiled with the aac USE flag.

The following streams are known to work with MPlayer:

Real Media

The following movies works if you add the -playlist option:

Quicktime

Windows Media

the following work with the -playlist option:

Problematic streams

Unfortunately there are some movies we can't display correctly:

For the MIT OpenCourseWare videos, there are instructions for downloading them on this page: [1]

Sometimes it helps to replace "pnm://" with "rtsp://" and play it.

Please edit this howto if you know how to play any of them.

Ripping

$ mplayer -noframedrop -dumpstream "<url>" -dumpfile <file>

or

$ mplayer -playlist "<url>" -dumpstream  -dumpfile <file>

Playing

If when trying to play a ripped RealAudio file MPlayer exits with the following error message:

Playing .RMF.
File not found: '.RMF'
Failed to open .RMF

create a text file called <rippedfile>.ram with the location of the ripped file (<rippedfile>.rm) as content:

File: <rippedfile>.ram
rippedfile.rm

If all fails, you could try downloading directly the file to you PC and the playing it with mplayer.

Useful links

From MPlayer's homepage:

From Gentoo Wiki:

From Gentoo Discussion Forums:

Others:

Retrieved from "http://www.gentoo-wiki.info/MPlayer/Rip_streams"

Last modified: Mon, 25 Aug 2008 07:29:00 +0000 Hits: 96,248