This guide is no longer maintained. It is stored mainly for future historians to investigate. For more up-to-date information, please see our other guides.
Over the past year or so, we have received tons of suggestions, ideas and rants about our existing DVD to DivX guide, most of them are related to the well-known bug in DivX5, which makes DivX5 codec very hard to deal with -- it doesn't obey requested bitrate levels if the movie gets "too big". Other requests have mostly related to the audio encoding, which in previous guide is done by using MP3 audio.
Within the last year, the open source alternative to DivX, called XviD has come to a mature age and it doesn't have the bugs of DivX5. Also, most of the users have finally understood that creating a backup of the DVD movie into two CDs gives clearly better results and also allows higher quality audio to be used. Therefor we decided to make a guide that uses the original sound format found on most of the DVDs, AC3, as our audio for this guide.
Please remember that this guide applies directly only to anamorphic DVDs (also called 'enhanced widescreens', etc), for old-fashioned 4:3 DVDs, the resize and crop options are slightly different (very shortly described in the guide).
First of all, you need to have these tools:
- XviD codec (for encoding the video)
- some sort of a DVD ripper
- DVD2AVI (frameserving from VOBs and extracting the audio)
- VFAPI Reader Codec (package includes VFAPIConvert, for frameserving from .d2v file to VirtualDub)
- VirtualDub (for encoding, etc)
- VirtualDubMod (we recommend that you d/l both VDub versions and use this one only for audio multiplexing and nothing more)
- XviD Bitrate Calculator (for bitrate calculations, obviously)
- Optionally Smart Deinterlace filter for VirtualDub, if the movie is interlaced
We recommend that you install VirtualDub and the modified version of VirtualDub, called VirtualDub AC3 to separate directories on your harddrive, so that they don't "confuse" each others. Also, install the separate filters into "original" VirtualDub's directory, leave the AC3 version to do just its job -- muxing the audio to video. In addition to this, you also need to have tons of free HDD space -- normally around 7GB -- and obviously a DVD-ROM drive :-)
What will happen during the process?
First of all, we need to have the DVD on hard disk in decrypted format. That means that the software cannot handle CSS encrypted video. These DVD files require decent amount of free HDD, normally 3 to 7 GB. Then we use DVD2AVI to extract the audio and create a frameserver .d2v file. Then, because VirtualDub doesn't support .d2v files directly, we need to convert the .d2v file into another frameserver file, what we call "pseudo-AVI" with VFAPIConvert.
After that's done, VirtualDub will have to go through various steps, including resize, crop and the actual video encoding. After that's done, we use specially-modified version of VirtualDub to multiplex AC3 audio track into newly-created XviD video. And that's it. Resulting video will be a 2CD XviD video with AC3 5.1 surround audio.
Sorry, this section of the guide had to be removed by the AfterDawn administration to comply with Finnish Copyright Laws that went into effect on 1 January, 2006. For more information please see this link -> http://www.afterdawn.com/guides/archive/afterdawn_guides_copyright_law.cfm
Determining the correct audio track
Ok, this is slightly tricky part. DVD2AVI doesn't tell us anything about the audio track's the VOBs have, nothing but the track number. So, we need to determine the audio track we want to use. Luckily, SmartRipper generates a small log file into the ripping directory that lists all the data streams found on VOBs.
So, let's open this file, normally named as vts_01_INFO.txt with text editor, such as Notepad. Once opened, scroll down to a part that says "Stream Info".
Now, we need to get the correct track number for the audio track we want to use. You see the list of streams that contains video streams, audio streams, subtitle streams and possibly "other" streams as well. Start counting from the top-most stream and skip all non-audio streams in your count. In this example, the Track 01 is the one that says Stream in its line, Track 02 is the one that says Stream and Track 03 is the one with Stream.
As we want to have the audio track that is in AC3 format and has 5.1 channels and is spoken in English, we look first for English tracks. Soon we notice that English tracks are Track 02 and Track 03. Both are in AC3 format, but only the first one of them has 6 channels (5.1) in it. So, the track we select, is Track 02 in this particular case. Now, try to remember this -- or if your mind is too wobbly that you can't remember one number, write it down :-)
Okay, next step is to separate the audio from the video (==demux) and to create a first frameserving file for the VOBs.
Open DVD2AVI and from File menu, select Open. Now, locate the ripped VOB files from your harddrive and select the first one in the list and click Open. After this, DVD2AVI should pop up a new window that lists all the VOBs you ripped to this directory. Simply check that this is the case and click OK.
Now, hit F5 from your keyboard and DVD2AVI will start playing the movie (it might -- actually it should -- be in wrong aspect ratio when played, but this doesn't matter) and opens another small window next to the playback window, called Statistics window.
Look at the Statistics Window while the movie is playing and write these things down:
- Aspect Ratio: either 16:9 or 4:3 -- if this is 4:3, this guide wont work for you, since the movie is not anamorphic
- Frame Rate: either 23.97, 29.97 or 25.00
- Video Type: this is important! This can be either PAL, NTSC or FILM (FILM has usually a percentage number -- if your movie says FILM, let the movie run for at least 5 minutes and write down the percentage shown in here)
- Frame Type: Interlaced or Progressive
Now, if your Video Type was PAL, you don't have to think about this further, skip to the next chapter. But if you have an NTSC or FILM type, this gets tricky. This is due the fast that normally NTSC movies have been "telecined" from 24fps framerate to 29.97fps in order to make the movies compatible with American TV standard (NTSC) by artificially increasing the framerate.
So, in order to remove these useless dupe frames and to get a pure, original-form movie out of the DVD files, we need to perform a Force FILM operation within DVD2AVI or IVTC in VirtualDub. Now, we have to decide, based on these facts:
- If DVD2AVI says FILM and no percentages at all and Frame Type was Progressive, you should perform Force FILM
- If DVD2AVI says FILM and percentage is over 95%and Frame Type was Progressive, you should perform Force FILM
- If the Video Type is NTSC and Frame Type is Progressive, you should use Force FILM (this is one case that CAN cause problems, but give it a shot)
- In cases where DVD2AVI says Frame Type is Interlaced and Video Type is either NTSC or FILM (with or without percentages), things can go pear-shaped easily. Suggested thing is to use DVD2AVI's preview and scrollbar and scroll around the movie and look at frames where there is lots of contrast -- such as man in black suit and with white background -- and look at the contrast points (where the black suit changes into white background) and see if the edges are "smooth". If not, movie is most likely a really interlaced. Otherwise you should also try to use Force FILM and skip deinterlace part later on in this guide.
Force FILM (optional)
Force FILM (optional)
Ok, if based on the above chapter, you need to perform a Force FILM operation, then this chapter is for you. If you have PAL material or otherwise twisted NTSC source, skip this chapter.
Simply go to to the Video menu and select Forced FILM under Field Operation submenu.
Now, go to Audio menu and go to Track number submenu and select the track number you wrote when you examined the SmartRipper's stream info file earlier.
Then, again from Audio menu, go to Output method submenu and select Demux (AC3, MPA, DTS).
Save the project
Next step is to save the project file (.d2v file) and the demuxed audio (.ac3 track) to HDD. Simply go to File menu and select Save Project. Select some short name and hit Save. Now DVD2AVI will extract the audio and write the project file. This doesn't take long -- the time depends on the length of the movie and speed of your harddrive -- normally couple of minutes.
Ok, since VirtualDub doesn't support .d2v files, we need to push the .d2v through another frameserver, or actually VFAPI codec. Remember to install the codec package found within the .zip file before you convert the .d2v into pseudo-AVI.
Start VFAPIConvert and click Add Job button. Now, file dialog opens. Simply locate the .d2v file DVD2AVI created for you and click Open. If you created the .d2v file in same directory where you also ripped the VOBs, there's a good chance that you see two .d2v files inside this directory. The other one is normally named as vts_01.d2v or similiar. Ignore this file as it is generated by SmartRipper and SmartRipper's .d2v generating doesn't work correctly. Open only the one you created with DVD2AVI.
Now VFAPIConverter should popup a small window that shows the Source(S) you selected and the suggested Output(S) filename. This should be OK by default, since this pseudo-AVI will be very small. Now check that Options are correct -- Export Video and Export Video through VFAPI Reader Codec should be both checked and the Export Audio should be dimmed. If this is correct, click OK.
Now, simply click Run and VFAPIConverter will create you a pseudo-AVI. This will take less than a minute, normally only couple of seconds.
Ok, launch XviD Bitrate Calculator. If you have problems with opening the software, you might miss few DLLs -- installing VB6 Runtime Module and MSSTDFMT.DLL if you experience problems should help.
Now, use the Movie Length slider to adjust the length of your movie, the number you wrote down earlier, in minutes (just for those who had F in maths, 1h = 60mins, so 1:55:09 length equals to 115mins and 9secs) -- preferrably one or two minutes more than the actual length, just to be on a safe side.
Next, move the Movie Size slider to 1409 MB -- this value is exactly the amount of data you can fit on 2 80min CDs. Now, click the Using Selected file(s) button and program will open a file dialog box. Select the AC3 audio track DVD2AVI created for you and click Select.
Now you should see a value next to Video Size at the bottom of the page. Write this value down and exit the program.
Now, launch VirtualDub -- the "original" version, not the Mod version -- and go to File menu and select Open video file... and locate the pseudo-AVI you created with VFAPIConvert and click Open. Now, if it doesn't open, you haven't installed the VFAPI Reader Codec correctly.
Next, go to Audio menu and select No audio (as we're going to add the audio afterwards).
Then, go to Video menu and select Full processing mode. After you've done this, select Compression, again from the Video menu and VirtualDub will open a new window that allows you to choose your compression method for the video. Select XviD MPEG-4 Codec and click Configure.
XviD's first pass settings
Now, VirtualDub has opened a small new window for you. From the Encoding Mode drop-down you should select 2 Pass - 1st pass. After this, click Advanced options.. button.
Ok, first we have Global tab. Change the Motion search precision to 6 - Ultra high in order to produce best possible quality. Next, change the Quantization type to MPEG as it will produce the best quality for two-CD rips. Leave FourCC used as XVID and leave the Maximum I-frame interval at 300 as well (if you wish to change this, the recommended method is to have appx. 10 times the framerate of your movie as your max interval). Same goes for Minimum I-frame interval -- leave it at 1.
All three checkboxes (Enable lumi masking, Enable grayscale and Enable interlacing) should be unchecked.
Don't touch this :-)
Two Pass tab
Check the Discard first pass box. Also, set manually the path for 1st pass stats -- if you don't do this, the 2nd pass wont find your 1st pass' analyzing data and the 1st pass is basically useless. After that's done, leave the rest of the settings as they are.
Alt. Curve tab
Don't touch this either ;-)
Now, this is interesting tab. Now, you can basically boost the quality of the movie slightly by encoding "useless" parts of the movie, such as credits, with lower bitrate. If you want to use this method, you need to return back to VirtualDub's main window and take a piece of paper and pen with you. Then start scrolling the movie with the slider in the bottom of the page and write down the beginning and end frames of the credits -- for both, credits at the start of the movie and credits at the end of the movie. Obviously this can't be done well if the credits include parts of the movie as well -- very often the case with the credits at the start of the movie. So, write down the frames and return back to this tab and enter the values to appropriate spots and fill the rest of the info as well -- boxes are relatively self-explanatory type.
Just leave the Automatically detect optimizations selected. After this, you can close the window by clicking OK. Now, close the codec selection window as well, by clicking OK.
Ok, if you have a NTSC movie or FILM with less than 95% of FILM material (PAL guys can skip this part as well as those who did Force FILM in DVD2AVI), you might want to do Inverse Telecine. IVTC basically removes the useless frames that were added when the original movie was turned into NTSC format.
Now, go to Video menu and select Frame Rate... Leave Source rate adjustment to No change and go to Inverse telecine (3:2 pulldown removal) and change the setting to Reconstruct from fields - adaptive. Now, close the window by clicking OK.
Deinterlace with Smart Deinterlace (optional)
Ok, now if your source was interlaced, you most likely need to perform this operation, in order to remove the problems with the video that interlaced material causes when transferred into other format.
We are going to use external VirtualDub filter for this process, called Smart Deinterlace, which -- as its name says -- is pretty smart :-) It performs interlacing only to those parts of the video that require it, such as fast motion scenes. Installing it only requires unzipping the package into VirtualDub's plugins directory.
Now, go to Video menu and select Filters. Next you should see VirtualDub to open a new window that lists your filters. Click Add and a new window opens. Select smart deinterlace from the list (if it doesn't appear in the list, click Load.. and find the .vfp file you extracted from the smartdeinterlace's package) and click OK.
Now, program opens up Smart Deinterlace's settings window. This is something that is slightly confusing and unfortunately there aren't really good "use this and that's it" type of instructions available for this filter's usage. But based on the experience and comments from various authors, these suggested settings here are a relatively safe bet -- but if you experience some sort of a weird movement jinxes in fast scenes, you might want to try other options.
Anyway, let's keep the Frame-only differencing selected, but take out the Compare color channels (instead of luma) checkbox (unless you're processing a cartoon, in which case this should be checked). Uncheck Show motion areas only and Blend instead of interpolate in motion areas. Check the Use cubic for interpolation -- this setting takes more time, but produces better results when encoding. Leave the default values in the numeric boxes -- 15 for Motion threshold and 100 for Scene change threshold. Finally uncheck the Motion map denoising. Leave all Advanced Processing checkboxes unchecked. If you wish to tweka around these settings, we recommend you to read the html file that comes within the Smart Deinterlace's package -- it explains the various settings in more detail.
After this is done, click OK to return back to the filter selection.
Now, let's get into resizing. Because AVI clips can't have anamorphic bit unlike DVDs, which do, we have to resize the video to be in correct aspect ratio. And as you have already understood, this guide is mostly for anamorphic DVDs. But if you insist to rip those oddball 4:3 aspect ratio movies, you can use this guide as well -- easiest way is to simply skip this part if your video is in 4:3 aspect and modify the cropping part to meet the "multiply-by-16" demans.
But to get into business, we need to get the video into correct aspect ratio. Now, we love to get the movies into 640 width, for various reasons -- it doesn't reduce the original width of 720 pixels "that much" and also is one of the "native" Windows resolutions, meaning that you can switch your PC's resolution to 640x480 and your player don't need to perform a resize-on-fly when you play the movie. So, we will use 640 pixels as a width for the video. Now, since anamorphic movies are in 16:9 resolution, we can easily calculate the height of the movie as well. Simply, let's take 640 and divide it by 16 (ok, get your calculator and check it) and we get 40. Now, since the width:height ratio is 16:9, we simply multiply the 40 with 9 and we get the height in pixels (calculators again..) -- 360. So, the resolution for us is going to be 640x360.
Okidoki, calculations are done. Now, you're still in the Filters list, right? So, simply click the Add again and select Resize and VirtualDub will open a new window. Now, simply enter 640 into New width box and 360 into New height box. Then, change Filter mode into Precise bicubic (A=-0.75) as this will produce the best possible quality when shrinking the image size. Don't select Interlaced or Expand frame and letterbox image checkboxes, they're useless in this particular case.
After you've done this, click OK to return back to the filter list.
Crop the video
Now, next step is to get rid of the black bars at the top and the bottom of the picture, if there's any -- note that even that there isn't any black lines, you still need to do this, if your resolution is now 640x360.
So, now we need to understand one important thing -- all video codecs love videos that have resolutions which are multiplies of 16. In most of the cases, they don't even start encoding your video if this is not the case. So, if we take a look at our width, it's 640. So, let's divide this by 16 and we get 40, which is integer and means that this width is in multiplies of 16.
Now, if we take a look at our height, it is now 360. Divide this by 16 and you get 22.5, which means that the height is not in multiplies of 16. Even if there isn't any black bars in the top or in the bottom of the video, you still need to get rid of at least 8 pixels to get the resolution to be in multiplies of 16 (such as 640x352).
Remember this "both, height and width, have to be in multiplies of 16" rule.
As we're still in the Filters window, we just click Add and select null transform and click OK. This will add a filter to the filter list that does absolutely nothing :-) And also allows us to add cropping to this filter.
So, next thing you should do, while null transform is selected in the list, is to click Cropping... This will open a new window for you.
Now, in this window you see the preview of your movie and four little boxes called X1 offset, X2 offset, Y1 offset and Y2 offset. Now, don't touch to X settings -- we don't want to complicate things too much :-) Use the slidebar to get into a frame that has movie in it, so you can see where the black borders begin and where the movie area ends.
Use the Y1 and Y2 settings to cut the top and bottom black areas. And now, remember that your original height was 360 when we got into this part. So, adjust the Y values to get rid of the black areas get your calculator ready and reduce the value what you have in Y1 from 360 and then reduce value in Y2 from this result. Now, divide this value with 16 and if you get an integer, you're good to go. If not, increase the black borders slightly until your final value (360-Y1-Y2) is in multiplies of 16. One of the most probable results is that you will get 44 in the top and 44 in the bottom part and this will result into 272, which is really in multiplies of 16. This is not the case always, but it is the case in very many movies (with "real" aspect ratio of 2.35:1).
Once you've cut the borders and confirmed the resolution, click OK to return back to the filter list. Then you can click OK to exit the filter list as well and to return back to the main window.
Save the first pass
Now, go to the File menu and select Save as AVI... Now, first thing what you should do is to select the checkbox that says Add operation to job list and defer processing, since otherwise VirtualDub will start encoding the first pass, which is useless for use right now. Then, simply enter the filename (we recommend to name it like 'movie-1st_pass' or similiar) you wish to have and click Save.
Change the second pass settings
Okay, now we need to save the second pass information as well. Go to the Video menu and select Compression. You will get the familiar compression codec list. Simply select the XviD codec and hit Configure.
Now, a new window opens. Change the Encoding Mode to 2 Pass - 2nd Pass Int (yeah, we will trust into XviD's ability to make these decisions). Then, exnter the video size you wrote down in XviD Bitrate Calculator into Desired size (Kbytes) box. Then, simply click OK as the Advanced options should have remained untouched since you saved the first pass. And then simply click OK in Compression window to return back to the main window.
Save the second pass
Now, go to the File menu again and select Save as AVI... Remember to select the Add operation to job list and defer processing box again, then simply save the second pass as well. Remember that this file will take about one gigabyte of your HDD space. Also remember that you can't save this in same name as the first pass file, so we recommend to name it something like 'movie-2nd_pass'. Then simply click Save and you're back into the main window.
Now, finally.. Prepare your bed, drink glass of milk and get ready for a good night's sleep :-) Go to File menu and select Job control. You should now see two jobs in the list. If this is the case, simply click Start and crawl to bed, this will take a while.
Multiplexing the AC3 with the video
Your video is finished, good morning :-) Now, we need to open the specially modified version of VirtualDub called VirtualDubMod which allows us to multiplex the AC3 audio into the XviD-encoded video. You can close the original VirtualDub by now.
First, go to File menu and select Open video file.. and find the second pass AVI you just finished and click Open.
Okay, next step is to go to the Audio menu and first select Direct stream processing. After that, select AC3 Audio, again from the Audio menu.
This opens a file dialog. Use this to locate the AC3 file you created with DVD2AVI and click Open.
Now, look at the filename of your AC3 file -- it should tell you some useful information, such as the bitrate of the audio and the delay value for the audio (marked in milliseconds in the filename).
Now, go to Audio menu and select Interleaving.... This will open a new window.
Now, interleaving settings can't be really told to you, but are more matter of a trial and error -- each movie tends to have different audio characteristics, but we try to ease this pain a little bit by giving some basic values that you should try.
For 384kbps 5.1 AC3, try to put 160 into Preload box and 160 into Interleave audio everyXXX box. Then change the selection next to the Interleave audio every XXX box to ms.
If your audio is in 448kbps 5.1 AC3 format, try 128ms values for both boxes.
Finally, enter the value you have in the AC3 filename to the Delay audio track by XXX ms box and close the dialog box by clicking OK.
Next, go to Video menu and select Direct Stream Processing from here as well.
After you've done this, go to File menu and select Save as AVI... Now, make sure that your destination directory has appx. 1400MB of free space and then pick a name for the file, something like 'the_movie_final_version.avi' and hit Save.
Now, VirtualDubMod starts writing the final file to the HDD. This takes couple of minutes, depending on your harddrive's settings and speed. This final file will include the XviD-encoded video and the original AC3 audio. After you've done this, you should be able to delete all the rest of the stuff you've made during the process from your HDD -- I strongly recommend that you test the final file before deleting anything :-)
For the audio playback, you most likely need to download the audiofilters package, available from Doom9's download page.
Splitting & rest of the stuff
Now, maybe you want to save this video to CD as well? If so, you will need to split it into half. Luckily we have exactly the right guide for this process :-) Simply follow this guide to split the movie.
And if you prefer to have subtitles (dubbing is a 8th deadly sin), you might want to read through our subtitle ripping guide as well.
As usual, all questions, comments and ideas should be posted to our discussion forums.
v1.0 -- 16th Oct, 2002, First version online (dRD)
v1.1 -- 7th Nov, 2002, Updated the XviD 2-pass tab settings to manually set the 1st pass analyzing log path. Also added the audio interleaving settings. Thanks for jukkaam for the tips! (dRD)
v1.2 -- 19th Nov, 2002, Changed references to VirtualDubMPG2 to VirtualDubMod, since VirtualDubMPG2 is now being integrated to this new VDub modification project. (dRD)
Written by: Petteri Pyyny