Thursday, December 18, 2008

How to convert DVD to 3gp proper way - 2nd part: No subtitles

Prepare everything as explained in the previous post.

1. Optional & highly recommended: Copy DVD files to the hard drive, eg. to the "c:\movies folder".
Tool: DVDDecrypter (use file mode)
2. Run VirtualDub, File->Open video file...
3. Browse to the folder where you extracted DVD files (e.g. "c:\movies"), view files in detailed view, sort by name, and select the first file of the biggest .VOB file set. Also check "Ask for extended options after this dialog":

4. Check "Open multiple VOB files as one virtual file"

5. In the Open Multiple VOBs click OK, and wait, until the MPEG-2 plugin parses the files (a minute or two)

6. In the Audio menu select "Direct stream copy" and choose the correct Audio stream (in this example only one audio stream was available):

7. In the Video menu, select "Full processing mode" and then click on Filters (CTRL+F)
8. Click "Add", choose "resize", and click OK:

9. Select "Compute hight from ratio" and type in 16 and 9, click OK

10. Just to clear up things what we'll do in the following step. This is what we have:
and this is what we want:
Sizes 320px and 176px are both multiples of 16, which is apparently good for mpeg4 encoding.

Add another filter, this time "Null transform", and click "Cropping"

11. Use the slider to find some bright scene, and drag the top and the bottom border to remove black fields at the top and the bottom of the movie
12. Add another "Resize" filter, this time type in just the following parameters:

13. Check the output video in the main VirtualDub window, it should be something like that: (on the left is the input video, on the right is the output video; don't bother about that green thing on this picture, it has to do something with the screen capturing and video memory I guess)
Make sure you have appropriate aspect ratio (scroll to some scene with round object like the moon or the sun, and make sure, it's really round).

14. Use the "Mark-in" and "Mark-out" buttons to select where you want your final movie (.3gp) to begin, and where do you want it to end. This way you can remove the opening and the closing credits from the movie:

15. In the "File" menu click "Start frame server":

16. use some unique name for the Frameserver name, it doesn't really matter what you type, you can also leave it default:

17. Save that "dummy" file as "c:\movies\movie.avi":
That file name must be the same as in the movie.avs file, which we have prepared in the previous post. This .avi file is not really an .avi file, through this file VirtualDub just "serves frames" to the program that opens this file (like some kind of server).

18. Now open your favorite command shell, also START->run->cmd will do. Run the following command:

c:\programs\ffmpeg\ffmpeg.exe -i "c:\movies\movie.avs" -vcodec mpeg4 -b 160k -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1 -an -y -f rawvideo NUL


Short explanation: First pass, no audio, according to this and this the following options are the best for mpeg4 video. But don't ask me, I have no clue what they mean. This first pass should finish in less than one hour on a fairly new computer.
Make sure you use input file movie.avs, not movie.avi, since ffmpeg can't handle VirtualDub frameserver file. This .avs file is again some kind of proxy, this time from Avisynth, and ffmpeg recognizes avisynth file. With this "almost hack" you can serve ffmpeg with VirtualDub frameserver.

When the job finishes, run another pass:
c:\programs\ffmpeg\ffmpeg.exe -i "c:\movies\movie.avs" -vcodec mpeg4 -b 160k -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 2 -acodec libfaac -ac 2 -ar 32000 -ab 88k -f 3gp c:\movies\movie.3gp

This second pass takes longer to finish, about an hour or two. If you don't mind about the quality you can run just one pass - use the above command, just remove option "-pass 2" (you can also remove options -mbd, -flags, -trellis, -cmp, -subcmp, -g, if you prefer that way).

With this settings 1hr of the movie takes around 110MB. If you like, you can choose some other settings for video bitrate (-b), audio bitrate (-ab) and audio sampling rate (-ab). With the settings above the sound quality is really good. You can also try some other sound settings. See the table below for the final size (in MB) of 1.5h movie, with 160kb video rate, and different audio bitrates (first column) and sampling rates (first row), results may vary:



That's it, now you can transfer movie.3gp to your mobile phone and watch your favorite movie, if your wife doesn't let you have the remote for your brand new FullHD TV (dream on, baby!) ;-). This is how it looks on my Nokia:
Fullscreen playback:

No comments: