User Tools

Site Tools


No ai soldati italiani all'estero




Rigacci.Org usa energia elettrica da fonti rinnovabili, grazie al gruppo di acquisto Merci Dolci.

Merci Dolci - Energia Rinnovabile

Software libero!

Petizione contro i brevetti software

Faunalia: Soluzioni GIS professionali



Mplayer and mencoder

Mplayer was also very useful in extracting audio (AC3) and video (MPEG2) from a badly encoded DVD, see Errori nella struttura di un DVD Video.


-dvd-device <path to device>

Specifica il device DVD, predefinito /dev/dvd. Si può indicare anche una directory che contiene i file precedentemente copiati dal DVD (ad esempio con dvdbackup o con vobcopy). Di solito per copiare il contenuto di un DVD la via migliore è l'utilizzo dell'opzione -dumpstream.

Selezione scheda ALSA per output audio

In questo esempio viene selezionata la seconda scheda audio (la prima ha il numero zero) per l'output:

mplayer -ao alsa:device=hw=1.0 file.avi


If you want to execute mplayer as non-privileged user, set /dev/rtc device to mode 0664. As far I know, this does not pose any security issuse. The usage of /dev/rtc can help synchronizing audio/video. Mplayer needs the ability to use high resolution timers, run this command as root every time your machine boots:

echo 1024 > /proc/sys/dev/rtc/max-user-freq

You can achieve the same result adding to /etc/sysctl.conf this line:



Check that you have the latest version of the file. With the Debian Marillat package you get it into /usr/share/doc/mplayer-k6/examples/. The same apply for the /etc/mplayer/mencoder_codecs.conf file.

Converting audio file with mplayer

In this example we will convert a Microsoft ASF audio file into a more usable WAVE audio PCM:

mplayer sample.asf -vo null -ao pcm:file=sample.wav


How to extract subtitles from a DVD-Video into VobSub format

A better way to convert DVD-Video subtitles into VobSub format is to use transcode.

This is because mencoder seems to produce different image data into the .sub file and slightly different timestamps into the index (.idx) file depending on the used video codec (-ovc option): strange enough, I got different outputs using copy and raw options. Transcode instead seems to be more deterministic.

We can use mplayer to identify subtitle streams contained into the DVD, they are identified by an ID and a language:

mplayer -dvd-device $RIPDIR dvd://$TITLE -identify

The following command will generate two files: vobsubs-en.sub and vobsubs-en.idx from the second subtitles stream (sid = 1).

mencoder -dvd-device $RIPDIR dvd://$TITLE \
    -nosound -ovc copy -o /dev/null \
    -ifo $RIPDIR/VIDEO_TS/VTS_01_0.IFO \
    -sid 1 -vobsubout vobsubs-en

With vobsub2pgm you can convert VobSub subtitles into single .pgm images.

Ripping a DVD with mplayer

Sometimes trascoding a video DVD with avidemux (my favourite transcoding program) does not give correct results. I transcode the VOB files directly from the DVD, but the resulting video gets the multi-angle scenes interlaced. I think that the problem aroses from avidemux not being able to cope with DVD multi-angle scenes.

mplayer instead plays the video correctly, so I use mplayer to extract a MPEG stream, and then I user avidemux to transcode.

First of all, we can play a DVD track from an .iso image mounted with the loop option. In this example we play track #27, using audio track ID 130 and no subtitles:

mount -o loop,ro dvdimage.iso /media/cdrom
mplayer dvd://27//media/cdrom -aid 130 -nosub

With this command we will dump track #27 to a raw compressed file, the file will contains all the audio tracks and subtitles:

mplayer dvd://27//media/cdrom -dumpstream -dumpfile dvd_track_27.vob

The dumped file can be played with mplayer or opened (and transcoded in XviD/mp3) with avidemux.

doc/appunti/linux/video/mplayer.txt · Last modified: 2020/04/21 08:54 by niccolo