Contents
[hide]
[edit]
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.
[edit]
Codecs
[edit]
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. If it isn't the syntax to compile it in is:
# USE="quicktime,win32codecs" emerge -av mplayer
[edit]
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 security proceed with the default way, otherwise carry on with the alternative way.
[edit]
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.
[edit]
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 /etc/portage.
If you don't know what an overlay is or you don't have it yet, please read this howto.
# mkdir -p /etc/portage/media-video/mplayer/files
# cp -Rv /usr/portage/media-video/mplayer/* /etc/portage/media-video/mplayer/
Now open /etc/portage/media-video/mplayer/mplayer-1.0_pre7-r1.ebuild with your favourite editor.
File: /etc/portage/media-video/mplayer/mplayer-1.0_pre7-r1.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_pre7-r1.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:
# echo "media-libs/win32codecs real" >> /etc/portage/package.use
[edit]
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!
Unabl to open URL: rtsp://realserver.kataweb.it/katanew/news_ansa/1099310401142_Mondo_20041101125647_low.rm
[edit]
Installation
This is simple:
# emerge -av mplayer
[edit]
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
Note: 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.
[edit]
Working streams
The following streams are guaranteed to work with MPlayer:
[edit]
Real Media
rtsp://ravi.br-online.de:5050/ravi/alpha/centauri/v/041027.rm
http://pdl.warnerbros.com/wbol/us/whv/med/matrix/collection/ultimate_matrix_collection_sizzle_tlr_100.rm
rtsp://a157.v59133.c5913.g.vr.akamaistream.net/ondemand/7/157/5913/418966df/whitehouse.download.akamai.com/5913/20041103-3.v.rm
rtsp://real.nasa-global.speedera.net/real.nasa-global/ascan_2004/hq_050604_spacedays.rm
rtsp://a1496.v78706.c7870.g.vr.akamaistream.net/ondemand/7/1496/7870/v0001/mitstorage.download.akamai.com/7870/8/8.03/f04/video/ocw-8.03-lec-mit-30sep2004-0007-220k.rm
rtsp://rmlivev8.bbc.net.uk/farm/*/ev7/live24/worldservice/livenews_v8.ra
pnm://rm.bbc.net.uk/news/media/audio/40386000/rm/_40386563_mol.rm
The following movie also works, but you have to play it with -vc rv20 and -fps 30 options:
rtsp://137.78.25.101:554/Video-Galileo-AVC-2003-182.rm
The following movie works with -vfm realvid option:
pnm://rm.bbc.net.uk/news/media/video/39688000/rm/_39688671_leeds23_gilmore_vi.rm
The following movies works if you add the -playlist option:
http://www.dreamworks.com/trailers/island/island_trlr3_rm_750.ram
http://www.ifilm.com/RealPlaylist?l=-2087040320&ifilmId=2669030&bandwidth=300
http://www.kusc.org/streams/kusc96.ram
http://play.rbn.com/?url=nfl/nfl/open/packers/demand/TrainingCamp05/050805sherman_300.rm&proto=rtsp
[edit]
Quicktime
http://movies.apple.com/movies/newline/blade_trinity/blade_trinity-tlr2_240.mov
[edit]
Windows Media
http://www.penguinbomb.com/omniscaper/WIPS/trench.wmv
mms://vip1.yacast.fr/encodereurope1
[edit]
Problematic streams
Unfortunately there are some movies we can't display correctly:
rtsp://realserver.kataweb.it/katanew/news_ansa/1099310401142_Mondo_20041101125647_low.rm
pnm://a1496.v78706.c7870.g.vr.akamaistream.net/ondemand/7/1496/7870/v0001/mitstorage.download.akamai.com/7870/8/8.03/f04/video/ocw-8.03-lec-mit-30sep2004-0007-220k.rm
http://moviesaskew.com/movies2/par.mov (no audio)
To solve audio problems, compile with aac, mmxext and sse2 USE flags (can't remember if they are all neccessary). Swift 11:31, 3 October 2005 (GMT)
http://www.exploratorium.edu/rafiles/cycling/r_braking.ram
http://64.236.34.4:5190/stream/1003
http://images.apple.com/movies/us/hd_gallery/gl1800/480p/the_brothers_grimm_m480pa.mov
http://www.the-mario-opera.com/mariopera_high.mov
Works for me, try AAC use flag --24.20.144.231 23:24, 16 October 2005 (GMT)
Please edit this howto if you know how to play any of them.
[edit]
Ripping
$ mplayer -dumpstream "<url>" -dumpfile <file>
or eg
$ mplayer -playlist "<url>" -dumpstream -dumpfile <file>
[edit]
Playing
If when trying to play a ripped Real Audiofile mplayer exits with a
Playing .RMF.
File not found: '.RMF'
Failed to open .RMF
create a textfile called .ram
rippedfile.ram
with the location of the ripped file as content, eg
rippedfile.rm
if both files are in the same directory
[edit]
Useful links
From MPlayer's homepage:
Streaming from network or pipes
From Gentoo Wiki:
From Gentoo Discussion Forums:
Others:
RealAudio and RealVideo Test Clips