Thursday, September 23, 2010

Automated HD Video Resizing Script

There are lot of steps involved in converting HD video to SD format for DVD authoring using freeware tools, check out my blog Converting High definition video to DVD compliant MPEG2 for the steps involved.

In order to simplify and make it a one step process, I have created a batch file which does the required job.


  • You should have your video clip as a Mpeg 2 I-Frame only Hd 19200 x 1080 interlaced, square pixel m2v file
  • You should have AVISynth installed, you may get it from


  • Download the complete package containing all the required freeware tools from here:

  • Extract into a location of your choice

  • Go to the command window and CD to the directory where you have your HD m2v file. (make sure that the extension is m2v)

  • run the bactch file with your mpeg file as a parameter without the .mtv extension:

    drive:\path\hd2sd YourMpgFile

  • After all the encoding and conversions are complete, you will have a file named YourMpgFile_DVD.m2v

    This is the DVD compliant wide screen anamorphic mpeg2 file, ready to be authored as a DVD

Batch File code

@echo off
set RootPath=%~d0%~p0

SET CACHEDIR=%RootPath%cache
SET VDUBDIR=%RootPath%vdub
SET HCDIR=%RootPath%HC023

%DGDIR%\DGIndex -IF=[%CD%\%1.m2v] -OF=[%CD%\%1] -exit

echo LoadPlugin("%DGDIR%\DGDecode.dll") > %1.avs
echo MPEG2Source("%1.d2v") >> %1.avs

%VDUBDIR%\vdub.exe /s %VDUBDIR%\HDToSd.vcf /p %CD%\%1.avs %CACHEDIR%\SD.AVI /r
echo avisource("%CACHEDIR%\SD.AVI").ConvertToYV12() > %CACHEDIR%\SD.AVS

echo *LOGFILE          %HCDIR%\HD2SD.log > %HCDIR%\HD2SD.ini
echo *BITRATE          7000 >> %HCDIR%\HD2SD.ini
echo *MAXBITRATE       8000 >> %HCDIR%\HD2SD.ini
echo *PROFILE          best >> %HCDIR%\HD2SD.ini
echo *AUTOGOP          18 >> %HCDIR%\HD2SD.ini
echo *DC_PREC          10 >> %HCDIR%\HD2SD.ini
echo *WAIT             0 >> %HCDIR%\HD2SD.ini
echo *MATRIX           mpeg >> %HCDIR%\HD2SD.ini

%HCDIR%\HCenc_023.exe -i %CACHEDIR%\SD.AVS -o %CD%\%1_DVD.m2v -ini %HCDIR%\HD2SD.ini

del %1.avs
del %1.d2v

No comments:

Post a Comment