Tuesday, September 21, 2010

Converting High definition video to DVD compliant MPEG2

I have tried using Vegas Pro and Adobe Premiere CS4 to convert my canon HF s100 1080i .mts files to mpeg2 for DVD authoring, in my opinion the conversions were horrible. There were lines (not interlace lines) which clearly looked like were due to resizing of the video.

I could not stand it so I looked for a solution over the internet, tried a lot of different tools and settings, nothing seems to work well, finally as it stands now I have come up with the following workflow which I think is the best so far.

[Here is an automated script to do all that.]

Tools Required
Adobe Premiere CS4 - This is for editing and exporting to an I-frame only MPEG2 file at highest possible quality, I downloaded the settings from here.

Free tools required (which does the real job)
AVISynth (at least ver 2.5) [link: www.avisynth.org/]
VirtualDub [link: http://www.virtualdub.org/]
DGMPGDec [link: http://neuron2.net/dgmpgdec/dgmpgdec.html]
HC Encoder [link: http://hank315.nl/]

I would like to give full credits to the respective authors of the tools, I can't believe that freeware tools like these does a better job than the ones that costs thousands of dollars.

  • Step 1: Export Clip to an I-frame only encoded MPEG2 file
    I followed the guide here to export my clip out of Adobe Premiere, look for the section "Exporting out of Premiere", lets call the exported clip mpgiframe.m2v

  • Step 2: Use DGIndex to index the MPEG2 file and save the project d2v file
    Run DGIndex.exe (you will have this file if you have downloaded DGMPGDec, see the link above) and open the "mpgiframe.m2v" file created in step 1, then save project giving it a name "mpgiframe", this will create a d2v (mpgiframe.d2v) file to be processed by DGMPG decoder in the later step.

  • Step 3: Create the AVI Synth file to be exported to Virtualdub
    Here is the AVS script which uses DGMPG decoder to decode the m2v file, which will eventually be served to Virtualdub.

    LoadPlugin("\pathtodll\DGDecode.dll")
    MPEG2Source("mpgiframe.d2v")


    open notepad and save the above code as mpgiframe.avs file

  • Step 4: Use Virtualdub to resize the AVS file and export it as AVI
    This is the critical step which most compressors fail to do properly. Run Virtualdub and open the mpgiframe.avs file, go to Video-> Filters->Add->resize.

    Aspect Ratio: Disabled
    New Size: Absolute 720 x 480
    Filter mode: Lanczos3 (this filter made my day)
    Interlaced checked

    Now select File->Save as AVI, (I am saving as an uncompressed AVI, I dont care about the size cause I have a ITB scratch disk to take care of that, the uncompressed AVI is the default VirtualDub settings you can find under Video->Compression)

  • Step 5: Use HC Encoder to encode the AVI file as a DVD compliant MPEG2
    Finally I convert the AVI file into DVD compliant MPEG2 file using the GUI version of the HC Encoder, just one problem with the AVI file is that the generated file color space is not compatible with HC Encoder we again create a AVS file with the following contents

    avisource("GenerartedAVI.avi").ConvertToYV12()

    Now just load this file in HC encoder and generate the DVD Compliant MPEG2 file for your DVD project

1 comment:

  1. In this century we all live in digital world, and we are used to share our important videos, photos, documents etc. with our family and friends or our business associates. And it is very easy to do it these days. You can share your documents, photos and videos on CD or DVD. CD Copies

    ReplyDelete