DVD to streamable mp4 on Ubuntu 9.04
This guide is intended to explain how to encode a DVD to a streamable mp4 codec under Ubuntu with ffmpeg.
Get Deps
The first thing you need to do is get the dependencies, you can do this with the following command;
sudo apt-get install build-essential dvdrip subversion avidemux libfaac-dev libspeex-dev libgsm-dev libgsm1-dev libmp3lame-dev libtheora-dev libvorbis-dev libx264-dev libxvidcore4-dev
Or you can click on this apt link, which will install these dependencies for you;
Set up Programs
ffmpeg
This part will require the terminal, to get to the terminal;
Applications > Accessories > Terminal
Then issue the following commands;
cd Documents ; mkdir src ; cd src
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
This will download a snapshot of ffmpeg, in the same terminal do the following to configure and install ffmpeg;
./configure --extra-cflags=-fno-common --enable-memalign-hack --enable-pthreads --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaac --enable-libgsm --enable-libx264 --enable-gpl --enable-nonfree
make
make install
cd tools
gcc qt-faststart.c -o qt-faststart
sudo cp qt-faststart /usr/local/bin/
libdvdcss
We need to set up protected DVD decryption Ubuntu makes this pretty easy, do the following commands to set it up;
cd /usr/share/doc/libdvdread4/
sudo sh install-css.sh
Ripping the DVD
Start dvdrip;
Applications > Sound & Video > dvd::rip
or “dvdrip” from cli.
When You first start dvdrip it will ask you what Directories to use for the projects, It’s up to you which directory to use. Once you have done that you will need to put a DVD into your DVD drive and start a new project. To start a new project go to “File > New Project” in dvdrip. You will need to enter a name for the project;
When you have selected a name for the project hit the “Create Project” button and select ok to save the .rip file, then select “Rip Title” and “Read DVD table of contents”;
When you have done that you have to select the title that the film is on, which is almost always the one with the most frames;
To rip the dvd select “Rip selected title(s)/Chapter(s)” button, highlighted in blue on the above picture. dvd::rip will begin to rip the dvd, on my computer it takes about 10 minutes to rip a title.
Merge Vob files
At this point merge the vob files with the cat command;
cat title-001.vob title-002.vob title-003.vob title-004.vob >> output.vob
(filenames covered up because despite having paid for the DVDs and the act that I’m only doing this for personal use, I don’t want to take any chances)
Cut and Crop Film
The next step is to use avidemux to cut, crop and transcode the video to a format ready for conversion to mp4. Start avidemux with the following command;
avidemux
open the merged vob file that you created in the previous step and when asked “This looks like mpeg
Do you want to index it?” select yes;
I takes a little while for avidemux to generate the index;
Select Output Formats
The first thing you need do in avidemux is select the output formats that you will use, for this I choose;
VIdeo: MPEG-4 ASP (lavc)
Audio: MP3 (LAME)
Container: AVI
Select filters
There are a couple of filters that you might want to take advantage of, for the video I use the crop filter, to do this select filter under the video section of the left hand side of avidemux and double click on crop;
This will bring up a window where you can set the crop dimensions, move the frame selector (highlighted in red) to a point in the movie where the border is well defined and press the Auto crop button (highlighted in green);
You might need to adjust the settings slightly, you should end up with something like this;
Click apply and then ok to accept these settings, then close the video filter window. The only filter that needs to be applied to the audio is the mixer setting, it needs to be set to stereo;
Audio > filters > mixer > stereo
Click ok and you will done with filters.
Cut video
You can set the start and the end point of the video using the a and b buttons you can use this to cut out the titles at the start of the film and the credits at the end;
Move the frame selector (Red) to where you want the video to start (you can fine tune with the arrows to the left of the “a” button) and press the “a” button (Green), the frame number will be shown in the bottom right of the window (Blue). Do the same for where you want the movie to end, substituting the “a” button for the “b” button.
Start encoding
Now that everything is set up, press the save button, give the file a name (you need to include the extension as avidemux doesn’t do this automatically) and press ok. Avidemux should begin encoding;
Encode to mp4
The final step is to issue two commands that will convert the file that avidemux created, into a stream-able mp4 file, the first command does the actual conversion;
/usr/local/bin/ffmpeg -i "input.avi" -vcodec libx264 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 1250k -maxrate 1500k -bufsize 4M -bt 600k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 "output.mp4"Where input.avi is the video created by Avidemux.
If you have a dual or quad core processor, it’s worth adding the “-threads” switch to that, so that you can get the most from your processor;
/usr/local/bin/ffmpeg -i "input.avi" -threads 4 -vcodec libx264 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 1250k -maxrate 1500k -bufsize 4M -bt 600k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 "output.mp4"Example for a quad core processor.
and this command makes the file stream-able;
qt-faststart "output.mp4" "faststart-output.mp4"Where “faststart-output.mp4″ is the streamable mp4 file.
comments
If you have any suggestions,questions or comments about how I could improve is article please feel free to leave a comment. Thanks






















Trackback by LEROY
Pillspot.org. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.PillSpot.org. Vitamins@buy.online” rel=”nofollow”>.…
Categories: Antibiotics.Blood Pressure/Heart.Eye Care.Skin Care.Antidiabetic.Mens Health.Womens Health.Vitamins/Herbal Supplements.Pain Relief.Anti-allergic/Asthma.Antidepressants.Stop SmokingAntiviral.Mental HealthAnxiety/Sleep Aid.Weight Loss.St…
Trackback by 1
1 http://04FORDPARTS.US/tag/1 : 1…
18 Scale airplanes 1/…
Trackback by Dragons And The Blade Of Light Shadow DS/
Emblem http://copious-systems.com/tag/Emblem : Dragons And The Blade Of Light Shadow DS/…
Emblem…
Trackback by Emblem
Dragons And The Blade Of Light Shadow DS/ http://copious-systems.com/tag/Emblem : Dragons And The Blade Of Light Shadow DS/…
Emblem…
Trackback by Sherwood
Sherwood http://ilaptopuhrpf42.BESTPARTSPLUS.INFO/tag/Entertainment Center Furniture Sherwood/ : Furniture…
Sherwood…
Trackback by positive
fertility http://lpositiveesl1b.04FORDPARTS.US/tag/fertility+kits+Ovulation+positive/ : fertility…
Ovulation…
Trackback by parts
daewoo http://odaewoojstbvt.BABYCLOTHESNUT.INFO/tag/R2-D2+daewoo+parts/ : daewoo…
daewoo…
Trackback by glass
24 http://aabovekgjo.APTAUTOPARTS.INFO/tag/24+glass+tall/ : 24…
glass…
Trackback by Wireless
Wireless http://baluminumnduf.BABYCLOTHESNUT.INFO/tag/Wireless+Ball+roller/ : Ball…
Ball…
Trackback by porch
scary http://gspookytb7kpb.copious-systems.com/tag/scary+Lights+porch/ : porch…
Lights…
Trackback by second
cup http://koaseijnrx.05KIAPARTS.US/tag/second+cider+Apple+cup/ : second…
second…
Trackback by Mattress
Mattresses http://ocrusherb-b1o1.AUTOTECHGUIDE.INFO/tag/Reviews+Mattresses+Mattress/ : Mattress…
Mattresses…
Trackback by 1991
1992 http://uwhatsbcl0h.BEDROOMPROPERTY.INFO/tag/1991+1993+1992/ : 1991…
1993…