Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back a page or two to re-sync the thread and this will then show latest posts. Thanks, Mike.

Howto convert an avi to DVD with corrrect aspect ratio using free tools

  • 28-01-2006 6:59pm
    #1
    Registered Users, Registered Users 2 Posts: 10,272 ✭✭✭✭


    I notice this crops up from time to time so I'll try and show how I do this.
    Might look like alot of steps but there's nothing like getting your hands dirty to achive great encodes vs. one click solutions.

    This will show you the method I use to convert an AVI to an MPEG2 video for use on a DVD. Can also be use for ASF, WMV but this guide will use AVI as an example.

    First, some DVD specs you must follow if you DVD is gonna play in every dvd player.
    There's two formats, PAL and NTSC. We use PAL here in Ireland.

    Allowable picture resolutions are:
    MPEG-2, 525/60 (NTSC): 720x480, 704x480, 352x480, 352x240
    MPEG-2, 625/50 (PAL): 720x576, 704x576, 352x576, 352x288
    MPEG-1, 525/60 (NTSC): 352x240
    MPEG-1, 625/50 (PAL): 352x288

    Maximum video bit rate is 9.8 Mbps. The "average" video bit rate is around 4 Mbps but depends entirely on the length, quality, amount of audio, etc.
    DVD pixels are not square unlike computer AVIs so it can cause confusion when it comes to conversion to some people.

    Video can be stored on a DVD in 4:3 format (standard TV shape) or 16:9 (widescreen). The width-to-height ratio of standard televisions is 4 to 3; in other words, 1.33 times wider than high. (Divide 3 into 4 and see what you get) New widescreen televisions, specifically those designed for HDTV, have a ratio of 16 to 9; that is, 1.78 times wider than high.

    DVD is specially designed to support widescreen displays. Widescreen 16:9 video, such as from a 16:9 video camera, can be stored on the disc in anamorphic form, meaning the picture is squeezed horizontally to fit the standard 4:3 rectangle, then unsqueezed during playback.

    Things get more complicated when film is transferred to video, since most movies today have an aspect ratio of 1.66, 1.85 ("flat"), or 2.40 ("scope"). Because these don't match 1.33 or 1.78 TV shapes, two processes are employed to make various movie pegs fit TV holes:

    Letterbox (often abbreviated to LBX) means the video is presented in its theatrical aspect ratio, which is wider than standard or widescreen TV. Black bars, called mattes, are used to cover the gaps at the top and bottom. A 1.85 movie that has been letterboxed for 1.33 display has thinner mattes than a 2.4 movie letterboxed to 1.33 (28% of display height vs. 44%), although the former are about the same thickness as those of a 2.4 movie letterboxed to 1.78 (26% of display height). The mattes used to letterbox a 1.85 movie for 1.78 display are so thin (2%) that they're hidden by the overscan of most widescreen TVs. Some movies, especially animated features and European films, have an aspect ratio of 1.66, which can be letterboxed for 1.33 display or sideboxed (windowboxed) for 1.78 display.

    Pan & scan
    means the thinner TV "window" is panned and zoomed across the wider movie picture, chopping off the sides. However, most movies today are shot soft matte, which means a full 1.33 aspect film frame is used. (The cinematographer has two sets of frame marks in her viewfinder, one for 1.33 and one for 1.85, so he or she can allow for both formats.) The top and bottom are masked off in the theater, but when the film is transferred to video the full 1.33 frame can be used in the pan & scan process. Pan & scan is primarily used for 1.33 formatting, not for 1.78 formatting, since widescreen fans prefer that letterboxing be used to preserve the theatrical effect.


    Alot more info can be found here.

    When encoding audio we normally use AC3, MPA or WAV
    AC3 has the benifit of more that 2 channels unlike MPA & WAV which are just stereo.
    You also need to encode at 48,000kHz

    If you source has already AC3 audio you may as well keep it. I'll add to the guide at a later date. Otherwise MPA will be fine. (Note: WAV files are ALOT bigger in filesize to AC3 or MPA as they're uncompressed for quality)



    First thing you must do is check the source AVI and decide if it's PAL or NTSC based. It might be neither!

    A good app to use is GSpot. It will show you loads or info about the avi, namely what frame per second (FPS) it is and also it's resolution....among other things.

    gspot13cn.png

    In this example you can see the video is 23.97fps. It's NTSC so we want to end up with a NTSC DVD fps of 29.97 (Not 23.97....read about Inverse Telecine here) We can also see it's widescreen too.

    Ok, now to work out how we're going to resize our avi correctly for DVD resolution. We can do it manually but a good app I use is FitCD.

    Open the avi in FitCD. (Ignore the top section)

    fitcd7ag4ew6bc.png

    Looks a bit complicated but there's only a few things that need chaging, if anything at all.

    As you change the settings, you can see FitCD change the preview on the fly. Notice the aspect ratio listed? I'm dealing with a NTSC widescreen source. (1.77) Not 1.78 but close enough. So I make sure I tick the anamorphic checkbox.

    If it's a full screen source we'd naturally uncheck it.

    You can usually tell just by looking if it's widescreen of not but it can be tricky to see if needs to be letterboxed sometimes.

    Once we're happy, save the script. Basically a small text file with an *.avs extension.

    Now, onto a brill app called AviSynth.
    From their homepage:
    AviSynth is a powerful tool for video post-production. It provides almost unlimited ways of editing and processing videos. AviSynth works as a frameserver, providing instant editing without the need for temporary files.
    AviSynth itself does not provide a graphical user interface (GUI) but instead relies on a script system that allows advanced non-linear editing. While this may at first seem tedious and unintuitive, it is remarkably powerful and is a very good way to manage projects in a precise, consistent, and reproducible manner.

    So, in essence, to a video editing program, that small script will be seen as an Uncompressed AVI at whatever settings we define in the script. If we want to change something, like resolution, there no need to deal with temporary files....we just edit the small script in notepad and save the changes.
    There are hundreds of other uses. See avisynth.org for more.


    If you what to test your script, open it in your favourite media player and ensure it plays ok. If you ticked anamorphic don't worry if people heads look "eggshaped". Just make sure it plays. If there's a problem, avisyth with display an error message.

    Now, onto encoding. (more to follow....)


Comments

  • Registered Users, Registered Users 2 Posts: 10,272 ✭✭✭✭Standard Toaster


    There are many, many MPEG2 encoders out there but we're gonna stick with the free ones right. :)
    One to check out is TMPGEnc

    It has a great wizard what will guide you through selecting the right settings for your DVD, be it PAL, NTSC, widescreen or fullscreen. It will autoselect a bitrate too depending on how big you what the final filesize.

    In my case, I'm gonna use the the NTSC 16:9 template:

    tmpenc014cb.png

    Hit next.
    When opening the avisynth avs, you'll have to 'show all files' as avs is not normally a video extension.

    There are a lots of settings you can change but since we went with a template alot of them will be locked out. All the better if your new to this to ensure your file will be DVD compliant. :)

    Use the settings here:

    tmpenc023or.png



    Once you hit start it starts encoding. Normally you'd do two passes. The first pass analysis the video and the second will encode. Results in better quality. You can set it to one pass to save time. Expect to wait a while as encoding is CPU intensive.

    Once it's done we have to mux the two files together as a VOB, what you'd normally see on a DVD.
    Again there are many apps out there to do this but since we're doing this with free tools it limits our options.

    One great tool for this is IfoEdit
    It has an easy create DVD mode.

    ifo15xo.png


    Load the video and the audio file in and select an output folder.

    ifo21dc5hc.png


    If you what chapters on your dvd it's kinda tricky here.
    You need to creat a txt file with where you want the chapter points to be using framenumbers.

    Like this:

    0
    1000
    2552
    32512
    54893
    

    Line one, chapter one. Line two, chapter 2, and so on.

    Save as a txt file and load it into ifoedit.
    You must ensure the chapter points are on Keyframes too or chapter selection will not be smooth. I might go into that and alternative methods later.

    Hit ok and IfoEdit does it's thing. You can now burn the basic VOBs & IFOs in your favourite burning app. Test the vobs before you do.


  • Closed Accounts Posts: 484 ✭✭ManWithThePlan


    Man that's brilliant advice there all free apps. too great job!!

    I just have one question.. my sony camcorder records as .avi but the files are HUGE. Will any of these apps compress the .avi before i put it onto DVD?


  • Registered Users, Registered Users 2 Posts: 2,321 ✭✭✭sham69


    Hi Guys,
    Thanks for the tutorial.
    I have a quick question, i have some AVi's and have tried converting them to DVD using AVI converter and DVD santa. The picture and sound quality are excellent but the frame rate seems to either sluggish (slow) or it speeds up every couple of frames. I have been using the principal that if the original avi is 23.297 i convert it to Pal, If its 29.297 i convert to NTSC and if its 25fps i convert to Pal. I have been using VT codec to check the format of the original AVI but am still a bit confused to which format i use, this has been annoying me for the past few months.
    Any help would be greatly appreciated.
    Many Thanks
    Sham69


  • Registered Users, Registered Users 2 Posts: 10,272 ✭✭✭✭Standard Toaster


    I just have one question.. my sony camcorder records as .avi but the files are HUGE. Will any of these apps compress the .avi before i put it onto DVD?
    I'm no expert on camcorders but I believe most of them use DV files probably using MJPEG codec or something similiar. As long as you have the codec installed on your machine most apps should be able to read the files.

    TMPGEnc uses Directshow to read avi's so as long as you can play the video file in windows media player TMPGEnc will read it fine.

    Now, if you use AviSynth like in the above example, it reads avis with "video for windows" (vfw) by default. You can use Directshow instead to read the avi if there's an issue. All you do is edit the text file (*.avs) to read like this:

    Before:
    avisource("C:\temp\my example movie.avi")

    After:
    Directshowsource("C:\temp\my example movie.avi", fps=23.97)

    This tells AviSynth to read the file via Directshow and tells it it's frame per second. AviSynth will try yo detect the fps but if it can't you must tell it yourself.


    If your camcorder captures the file interlaced you can deinterlace it in
    TMPGEnc. Great explaination about that here.
    Keeping it interlaced will give it a more or a 'TV' feel.

    You can deinterlace in AviSynth too. See here for more info.

    If your camcorder captures at DVD resolutions you might be able to skip straight to TMPGEnc. You just need to set if it's PAL or NTSC and if it's 4:3 or 16:9.


  • Registered Users, Registered Users 2 Posts: 10,272 ✭✭✭✭Standard Toaster


    sham69 wrote:
    Hi Guys,
    Thanks for the tutorial.
    I have a quick question, i have some AVi's and have tried converting them to DVD using AVI converter and DVD santa. The picture and sound quality are excellent but the frame rate seems to either sluggish (slow) or it speeds up every couple of frames. I have been using the principal that if the original avi is 23.297 i convert it to Pal, If its 29.297 i convert to NTSC and if its 25fps i convert to Pal. I have been using VT codec to check the format of the original AVI but am still a bit confused to which format i use, this has been annoying me for the past few months.
    Any help would be greatly appreciated.
    Many Thanks
    Sham69
    When most films are filmed at 24fps and when are being transfered to DVD get speed upto 25fps for PAL and 29.97fps for NTSC.

    The process where studios add additional frames to the picture in order to increase the framerate is called telecine. Processes where various video editing tools reverse this process is called inverse telecine. (IVTC)

    So, whoever made that AVI reversed the telecine process to reduce framerate to 23.97 and to also save on filesize. (Less frames = less MB wasted and increses quality per MB)

    Read more about telecine here.

    Telecine is a process where the FILM first is slowed down to 23.976 frames/second. Then for every 4 frames, an extra frame is created from fields of adjacent frames. If a frame consists of two fields, top (t) and bottom (b) and the original sequence is 1t1b 2t2b 3t3b 4t4b, then the telecined sequence would be 1t1b 2t2b 2t3b 3t4b 4t4b (commonly called 2:3 pull down because of the alternating 2 field, 3 field progression). This also means that the frame rate increases to 29.97 frames/second.

    Telecine.gif

    Changing between NTSC and PAL and vise-versa will result in horrible issues with framerate etc. You'd have to change the pitch of the audio too. Too much hassle if you want to do it right.

    You can use " AssumeFPS(29.976)" or "AssumeFPS(25)" in AviSynth to convert be se warned to have to extract the audio and "stretch" the lenth to match you desired encode. Cooledit will do it or use Besweet if you want to use free tools.

    No program that I know of (Accept AVISynth) will do Proper NTSC/Pal conversions including TMPGEnc. Those programs use Frame Duplication and Decimation to convert Frame rates which will end up giveing you a Jumpy effect on Playback in high motion scenes. The Proper Method for Converting Ntsc/Pal is either to Slow down/Speed up the Video/Audio to the New Frame rate(25fps Progressive slowed down to 23.976fps then add 3:2 Pulldown Flags to make it 29.976fps) Or to use Field Interpolation like when going from 25fps interlaced to 29.976fps interlaced...

    AVISynth can do both of these methods of Frame rate conversion but AVISynth is fairly complex to learn for someone who has never used it before.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,321 ✭✭✭sham69


    Thanks edge that makes things a bit clearer.
    I might try some of the software you recommend.
    Its funny coz some of the end products come out ok and others are either too fast or too slow. I will keep trying anyway.
    Many thanks again for the posting it has been a great help in understanding the differences between the standards.
    Regards
    Sham69


Advertisement