CREATION OF DVD COMPLIANT STREAMS FROM AVI SOURCE(SERIES OF AVIs - divx, xvid, mpeg4, etc.)
First let me say that this is my first HOWTO. I apologize at the start for any inconsistencies, typos, erroneous information, omitted procedures or damage done to your brain while attempting to make sense of this mess. This is not the ultimate way to do this nor do I in any way consider it the best. This is just the procedure that I've been using. Some steps may be redundant or could possibly be incorporated into one of the other tools. I would accept any reccomendations as to simplifying this procedure.
WARNING: Be mindful of any command line reference that wraps to the next line. All commands and thier arguments from each individual step in this HOWTO are meant to be one contiguous line input.
NOTE: Any conversion times or estimated file sizes are only a reflection of my SuSE 10.2 32bit system. Your mileage may vary.
TOOLS NEEDED:[version used in creation of HOWTO]:
mplayer [1.0rc1try2-2.pm.2]
normalize [0.7.7-0.pm.3]
toolame [02l_02mbeta8-0.pm.5]
avidemux [2.3.0-2.pm.0]
assorted codecs and underlying dependencies that should be available to your distro
(if anything is missing, the console should reflect that immediately, install what it can't find)
STEP 1 - AUDIO EXTRACTION
The audio must be made DVD compliant. To do this it must first be extracted from the AVI file. Mplayer does this quite nicely. It will take a little while - say 12mins/hr of stereo audio. These wave files can be quite large - approx 10MB/minute of stereo audio. A 2hour movie can easily have over 1GB of stereo audio.
$ mplayer -vc null -vo null -srate 48000 -ao pcm:fast -ao pcm:file=name_of_avi_file.wav name_of_avi_file.avi
name_of_avi_file.avi is the input file.
name_of_avi_file.wav is the resultant extracted file.
STEP 2 - AUDIO NORMALIZATION
Not everyone uses the same equipment for creation of video files. Audio levels are hardly ever consistent from one file to the next. Use the default(-6dBFS) for normalizing. It's pretty quick.
$ normalize name_of_avi.wav
name_of_avi.wav is the input and output file as this is done in place.
STEP 3 - AUDIO CONVERSION
We must now convert our wave file to an mp2 file(for basic stereo). I use a bitrate of 128 as it keeps the file size small and makes decent quality for casual watching of videos. toolame makes quick work of converting - about 1min/25mins of stereo audio. I have to set the psychoacoustic level to 2(-p 2) as the default 3 usually segfaults.
$ toolame -s 48000 -b 128 -p 2 name_of_avi.wav name_of_avi.mp2
name_of_avi.wav is the input file.
name_of_avi.mp2 is the output(mp2 converted) file.
STEP 4 - REMOVING TEMP FILES
The audio section is now complete with all audio files ready for DVD authoring. The wave files can be removed at this point as they are no longer needed.
$ rm *.wav
STEP 5 - VIDEO CONVERSION
This is the most complicated step and the process is usually the longest. The video needs to be converted to a DVD compliant mpeg2 elementary stream. Not only that, it also needs to be formatted for the target viewing medium - in this case a standard NTSC television. Make use of 2 filters in AVIDEMUX 2.
Filter 1 is Mplayer Resize. Since the target is a standard 4:3 NTSC television you must keep the resolution of 720x480(1.5 aspect or roughly 4:2.666 not 4:3) in mind. This is the resolution the DVD player will send to the television. The television itself will take that resolution and convert it to the 4:3 picture(an equivalent of about 720x540 - 1.333 aspect).
I have found the resolution of 624x416(1.5 aspect) to be adequate for a 4:3* source picture. This is much smaller than 720x480. The reason for this is that you must take into account television overscan area. If you do not do this you will be losing alot of video information around the sides of the picture.
* For other aspect ratios you must reconfigure the height. What I like to do is take a screen shot from the original file. Open it in an image editing program, such as the Gimp. Resize the image(with the aspect locked) so that the width is 624. Change the canvas size to 720x540 and center the image on the canvas. From there, you resize the entire image to 720x480. Crop the center image and you now have the needed height information. Example, you have an avi that is 640x368. Following the above procedure you will come to the required height of ~320 pixels. So you would input 624x320 into the scale filter to obtainthe proper aspect ratio(no stretched or squashed pictures when you watch it on a television).
If your source's aspect is out of whack, you must give your best guess to get it back in shape. Tryto find something in the source picture you can use as a geometric point of reference, for instance a perfect circle or square. Use your image editing program to get that shape back as close to normalas you can. Once you find the proper resolution you can get back to the procedure above.
Filter 2 is Add Borders. Like it says, it adds borders(usually black) to fill out the rest of the picture within the overscan area. Given our resized resolution of 624x416 and our target resolution of 720x480, some simple math will tell you that you need to add 48 pixels on both horizontal(left and right) sides and 32 pixels on both vertical(top and bottom) sides.
The easiest way to obtain the filter file is to fire up AVIDEMUX 2, open the original AVI file, change the Video drop down box from Copy to DVD then click the filters button. This opens the Video Filter Manager. Our main concern is the Transform tab. In there, first double click the Mplayer Resize filter. It will open a dialog with your original video file's dimension. Change this to 624 width and 416 height. Also change the resize algorithm to Bicubic. Click OK to activate the filter. Now double click on Add Black Borders. Input the border dimensions we discussed earlier. 48 left. 48 right. 32 top. 32 bottom. That's all we need of the filters. Click Save Script at the top and give it a simple name like resize_border.flt and make sure to save it to your project's directory. The filter file is an XML file so you can have a look at it to see it's structure if you are so inclined.
Now that we have our filters, we can get on with the conversion.
$ avidemux2 --load name_of_avi.avi --output-format ES --video-codec XDVD --filters name_of_filter_file.flt --video-conf 2pass=1000 --save name_of_avi.mpg --quit
name_of_avi.avi is the input file.
name_of_filter_file.flt is the file you saved your list of filters to.
name_of_avi.mpg is the DVD compliant, elementary video stream, output file.
Like i said, the conversion will take quite a while. Possibly it will take almost as long to convert the video as it would be to watch it in real time, especially since I make use of the 2pass conversion process, which obviously doubles the amount of time it would take. The number following 2pass= is the target file size(in MB) you wish to have for your final .mpg. Keep in mind the size of DVD you plan to use while figuring out your video file size. Don't forget that your audio file could take up a few hundred MBytes - this is one of the reasons I take care of the audio first.
STEP 6 - DVD AUTHORING
You should now have your DVD compliant .mpg(Elementary Video Stream) and .mp2(Elementary Audio Stream). Author the DVD however you wish. I use DVDLabPro 2 through Crossover Office but that's just my preference.
I welcome any and all constructive criticism about this HOWTO. Since this is my first HOWTO, formatting suggestions are extremely welcome.
sodsm live
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
M4V to AVI in VD, when compressed with Xvid, saves with audio out of sync
By kiki hayes in forum Newbie / General discussionsReplies: 4Last Post: 4th Aug 2011, 09:45 -
converting hd sources to .avi - xvid or divx6/7 ?
By uk_dan2k in forum Video ConversionReplies: 3Last Post: 23rd Apr 2010, 08:11 -
Best way to create DVD from diverse sources (various AVI + WMV)
By morgan.freeman in forum Newbie / General discussionsReplies: 5Last Post: 28th Feb 2010, 15:54 -
How to Create FLV files from AVI material ( Xvid / Divx )?
By devilcoelhodog in forum Newbie / General discussionsReplies: 5Last Post: 19th Jan 2010, 09:31 -
How to create a DVD using multiple DIVX/XVID files with Menu
By Amourek in forum User guidesReplies: 2Last Post: 2nd Mar 2009, 08:57