Monday, 28 May 2012

Rip a DVD Using The Command Line

Use this command to rip a DVD using the command line.

Mount a DVD disc or iso to a convenient place. I will use an iso in this example;

mkdir /tmp/dvd

sudo mount -o loop /path/to/dvd.iso /tmp/dvd

Issue this command to rip a DVD to a file in your home directory;

cat ./VIDEO_TS/VTS_01_1.VOB | nice avconv -i - -s 512x384 -vcodec libtheora -acodec libvorbis ~/dvd_rip.mp4

If you prefer to use closed h264 and mp3 codecs you can install them from the multiverse repository;

sudo apt-get install libavcodec-extra-53 (libavcodec-extra-52 for maverick and earlier)

Change these parameters;

-vcodec libx264 

-acodec libmp3lame

The default bitrate is about 800kbs. To change this use these parameters;

-b 1200000       : Video in bps

-ab 128000       : Audio in bps

Sometimes you don't want to re-encode the streams, in such cases you copy the stream using -c:v copy, -c:a copy and -c:s copy (for subtitles)

Example: Transcode video but copy audio;

cat ./VIDEO_TS/VTS_01_1.VOB | nice avconv -i - -vcodec libx264 -c:a copy -b 1200000 ~/dvd_rip.mp4

Notes: The '-i -' means take input from stdin

1 comment:

PH said...

Nice, but i have few questions :
Why use "cat ./VIDEO... | avconv -i -", and not simply avconv -i ./VIDEO... ?

How to choose the appropriate .vob file amongst .vob files in an usual dvd ?

What do you mean with [1234] within the .vob filename in your example ?

How could languages and subtitles be managed within such a command line ?