Sunday, March 04, 2007

ripping a dvd with acidrip

Intro article
Before you get started, here is an excellent introductory article on how to use acidrip:

Here are the quick steps to the install. As my distro is fedora, you'll need to have the fedora and freshrpms repos in /etc/yum.repos.d. Also, the perl rpms and Gtk2/Glib perl programs listed are from
yum install gtk*
yum install lsdvd
rpm -ivh /root/Desktop/perl-ExtUtils-Depends-0.205-1.fc4.noarch.rpm
rpm -ivh /root/Desktop/perl-ExtUtils-PkgConfig-1.07-1.fc4.noarch.rpm
tar zxvf Gtk2-1.143.tar.gz
tar zxvf Glib-1.144.tar.gz

You can burn to avi or mpg container format with a number of codec options. Taking the defaults for lavc or xvid codecs yielded a video with correct audio, but thick, green lines across the bottom half. Two-pass lavc ended up with the same green lines. The "copy" function worked without green lines, but the resultant avi file was too big (3.5GB). Outputting to MPG using lavc, xvid or two pass also shows green lines, but using "copy" yielded a smaller (2.5GB) file.

It is interesting to note that xine, mplayer and ffplay could not play the avi. However, ffmpeg was able to re-encode the avi file. The mpg was playable in all players, but all had stutter and lost audio sync if forward was pressed during playback.

Since the filesize was huge, I decided to re-encode in order to fit on a standard CDROM. Re-encoding the mpeg using FFMPEG -target dvd outputted to a second, smaller mpeg was a disaster: the file did not play properly (mostly audio sync problems) in any Linux media players. Therefore, I am going to reencode the avi using FFMPEG. Rendering using FFMPEG to DVD is pretty bulletproof: a video rendered with FFMPEG plays in almost all my Linux media players; however, FFPLAY seg faults, which is strange as it is the companion player to FFMPEG.

Re-encoding using FFMPEG bitrate (-b) switch
I took the resulting file and used ffmpeg to shrink the size of the file by outputting it to a lower quality bitrate mpeg2. This was done by using ffmpeg's bitrate (-b) switch:
ffmpeg -i charade.avi -target dvd -b 3000 charade.mpg

This cut down the file size by about 33%.

I then lowered the bitrate further to 1500. The resulting file size was a little more than 1/3 the original and still looked decent. Finally, I lowered the bitrate to 750. The resulting file was about 1/4 the original size, but started to show compression artifacts. That was the limit on my tolerance for crappy looking video, so I stopped there.

bitrate: file size reduction
3000: 33%
1500: 65%
750: 75%

I will continue to experiment.

3/10/2007 update
Re-encoding using FFMPEG Qscale (-qscale) switch
I've experiment a bit more. Instead of using -b as a switch to ffmpeg, I used -qscale. Qscale is short for quality scale. The scale ranges from 1 to 30, with one being the highest quality audio and video output with the least reduction in file size and 30 being the lowest quality output with the most reduction in file size. My goal was to reduce a DVD from 3.5GB (avi) to an mpeg less than 700MB in order to fit on a CDROM. I hoped the re-encode would occur without appreciable quality loss in the audio or video, but I wasn't sure.

By testing a number of Q factors ranging from 5 to 10 to 15, I was able to reduce the original 3.5GB avi file to 628MB without a terrible amount of compression artifacts. There was a loss of video quality, but not to the extent that the video was unwatchable. The audio, however, was still good and the size of the file had been reduced by almost 5/6ths! Excellent! Here is the command I used:
ffmpeg -i charade.avi -target dvd -qscale 15 charade.mpg

In the final analysis, it seems the easiest way to use acidrip is to:
1) rip DVD to avi using copy feature
2) if needed, reduce file to CDROM size using FFMPEG's Qscale parameter

that's it for now..

1 comment:

Unknown said...
This comment has been removed by a blog administrator.
Feel free to drop me a line or ask me a question.