User Tools

Site Tools


tutorial:dvd_to_avi

DVD/MPEG-2 to AVI

This tutorial explains the process of converting an MPEG-1 or MPEG-2 DVD file into an AVI file containing MPEG-4(nbsp)ASP video (this is often incorrectly called “DivX” or “Xvid” - see the Common myths article for an explanation of the words DivX and Xvid and the difference between software and format).

There are several programs available online which allow you to convert DVDs to MPEG-4(nbsp)AVI, using tools such as the popular MEncoder. The difference between Avidemux and these other projects is that Avidemux allows you to edit the file before encoding it, and to do a visual check of what you are doing.

Understanding MPEG file types

  • m1v means “MPEG-1 Video”, i.e. a file which only contains a so called elementary video stream, without any audio.
  • m2v means “MPEG-2 Video”.
  • mpg is a program stream containing the multiplexed video and audio streams.
  • vob is a DVD system stream which contains video, audio and additional information, it is a also a program stream.
  • vdr is a transport stream containing video and audio(s). It is supported but without sync correction.

Getting a usable VOB file using MPlayer

mplayer dvd://1 -dumpstream -dumpfile rippeddvd.vob

This will create a file in your working directory called rippeddvd.vob. This is an Avidemux compatible VOB file in MPEG format with the various audio streams included on the DVD.

Loading and indexing your MPEG file

Load this rippeddvd.vob file into Avidemux by either clicking the “Open” folder icon in the toolbar, or going File→Open.

You will now be presented with a dialog box with a dropdown list of audio stream choices. This is where you pick which audio track on your DVD you want to use for your video. Generally the default, or first in the list is the best choice. Click “OK” to begin indexing the MPEG. This may take a number of minutes depending on the speed of your machine.

Note: Avidemux does not read MPEG streams. It has been designed to read an MPEG stream index. An MPEG stream index is a plain text file containing a description of the MPEG and the location of frames throughout the stream. This file allows Avidemux to random seek and stay accurate. Said otherwise, without the index, Avidemux cannot handle MPEG files.

Editing

NTSC versus FILM

Some DVDs are coded as 23.976(nbsp)fps aka FILM (most movies actually). Some others are coded as 29.96(nbsp)fps (NTSC), soap for example. In the first case, the DVD player does an operation to convert it on the fly to NTSC format (telecine). So the MPEG header always says 29.96 as it will always be the final format.

Avidemux uses mpeg2dec to decode MPEG streams (with a little patch). mpeg2dec does not do the telecine on FILM movie (and that's better that way).

It means that Avidemux cannot tell the difference between FILM and NTSC. So if the MPEG looks progressive (not interlaced) and obvious desync appears (and gets worse and worse), use Video→Frame Rate and set it to 23.976.

For PAL MPEG, there is no problem, it is always 25(nbsp)fps.

If audio is present, Avidemux will try to guesstimate if the video is 23.976 by comparing audio and video duration.

Cropping

Cropping removes the black borders along the top and bottom of the video in a widescreen format DVD. It allows more data to be used in encoding actual picture information. Without cropping, the sharp edges would radically reduce picture quality in these areas, as the MPEG based codecs do not handle them well. Always make sure you remove all borders completely, even if they're only half-black or unclean.

  1. To crop the video, we must use the video filters. Before selecting the filters however, use the slider bar at the bottom to select a spot in the middle of the movie. The reason for this, is that auto crop feature will adjust the cropping based on the current frame.
  2. Now press the Video Filters button to popup the video filter list.
  3. Add Transformation → Crop.
  4. Now click the “AutoCrop” button. You'll notice the black areas will now appear in green to show the areas where the video will be cropped.
  5. If you like the way it looks click “OK” and then close the video filters list.

Resizing

You probably want to resize the video to something smaller. Lower resolution means higher bits/pixel ratio, which may improve quality at lower bitrates that are typical for MPEG-4.

Also, AVI files do not contain aspect ratio information (but it can be stored inside the MPEG-4 bitstream), so you'll have to resize the video after cropping to get the correct aspect ratio. The aspect ratio is the shape of a pixel. On a PC it is mostly square, however, on a DVD it could be 4:3 or 16:9.

So, bring back up the video filter list.

  1. Select the input aspect ratio (16:9 is the most common for DVD) and target aspect ratio (1:1 for AVI).
  2. Then select the resizing method(nbsp)– bilinear is not as sharp as bicubic or lanczos, but is generally more compressible. So it depends on the bitrate (sharper methods for higher bitrates), source video compressibility and your taste (some people prefer sharper video even if it means more compression artifacts such as ringing).
  3. You will want to check the 16 round up to be sure the final width and height are multiples of 16.
  4. Then move the slider until you reach the desired width.

More video filters and cutting

Depending on the source, you may want to add more filters (subtitling, denoiser, deinterlacer, IVTC etc.).

At this point, the video is ready for any editing/cutting you may wish to do.

Configuring video

Choosing an encoder

Now choose the video encoder from the drop down list. The two MPEG-4 encoders supported by Avidemux are Xvid and FFmpeg(nbsp)(libavcodec)(nbsp)MPEG-4. Both are very good and more or less comparable, so it's up to you which one you prefer. We'll use Xvid in this tutorial, as it's currently better supported in Avidemux and therefore recommended.

Configuring the encoder

Click the Configure button and you will be presented with the Xvid Configuration window. It is highly recommended to use 2(nbsp)pass encoding so you can select your final file size. Don't worry about the final file size, and set the options as you would like to have them and click OK to save the settings.

Calculating video size

Now use the Calculator, make sure Format is AVI, select your medium (i.e. final file size), and click Apply. This will automatically fill in the file size in the Xvid Configuration window. The calculation results will be displayed in the window. You can close this window now.

Configuring audio

Selecting audio track

The first step is to choose which audio track to encode. By default the first audio track is selected which on a DVD should be the main language of the DVD (i.e. English for Region(nbsp)1). To choose another main audio track go to Audio→Main(nbsp)Track and use the drop down box to select the internal audio track you want, or if you desire you can choose an external audio source. If you want a second audio track to be encoded use Audio→Second(nbsp)Track.

Checking A/V sync

At this point you want to check the audio sync. Turn on the filtered output preview mode and make sure the audio is synced, if it's not, use the Shift feature to correct this.

Choosing audio encoder

Next you must decide which encoder to use. MP3 via LAME is the most supported format. Keeping the default AC3 track is also a very good option for 5.1(nbsp)sound. Recompressing from an already lossy compression will never sound as good, the file size savings won't be too great in using another codec, and you will save time in not compressing the audio.

Audio filters

Finally you must decide if you need or want any filters.

Saving

Now select File→Save→Save Video and wait. Avidemux will do pass 1 then switch to pass 2 (including audio). The result will be an AVI file with MPEG-4(nbsp)ASP video and MP3 audio inside.

tutorial/dvd_to_avi.txt · Last modified: 2012/11/11 08:51 (external edit)