Log in

View Full Version : Batch Deinterlacing Script[Give me some advice please]


ZZy
5th August 2012, 12:44
Object:
Encode the interlaced soure clips from VCR, Camera, HDTV Recoding, etc...into progressive, lower-lossy, editable ones.

PS: I'm quite interested about x264 encoding and deinterlacing, but my English is not so idiomatic,:D If you have any questions or advices about, please tell me. Email:987175004@qq.com Thx~~I hope this scripe may help you.


Basing on:
1. Avisynth2.5
2. QTGMC
3. DGindex / DGAVCDec / DGNV tips: DGindex for mpeg source; DGAVCDec for H.264 source; DGNV for NVDIA users . Megui package whose offical download add is blocked as well -_,- , containds these 3 indexers.
4. VLC or win7codec
5. mkvtool or mp4box
6. x264.exe


Script:


@echo off

::This script was used to encode a1080i TOD files, you should replace the TOD with the extension of the clips that you want to encode.

echo ———————————— Batch Deinterlacing Script ————————————
echo Copyright ZZy
echo Sina twitter 2516528770
echo.
echo Never close the window unless the encoding is acomplished!
echo.
pause

::Step 1: Create indexes and extract audio tracks
for /r %%a in (*.TOD) do dgindex -IF=[%%a] -OF=[%%~na] -exit -minimize
:: Do not forget to use DGAVCDec instead of DGindex when indexing H.264 source;
:: DGindex creates d2v and DGAVCDec creates dga. What about DGNV? I don't know...
cls
echo Indexes All Created...
del *.log
echo.
echo ——————————————————————————————————
echo.

::Step 2: Create avs scripts
for /r %%a in (*.d2v) do > ".\%%~na.avs" ECHO DGDecode_mpeg2source("%%a")
for /r %%a in (*.TOD) do >>".\%%~na.avs" ECHO #trim(0,50)
for /r %%a in (*.TOD) do >> ".\%%~na.avs" ECHO Import("QTGMC.avsi")
for /r %%a in (*.TOD) do >> ".\%%~na.avs" ECHO QTGMC(preset="fast")
for /r %%a in (*.TOD) do >> ".\%%~na.avs" ECHO TopField=SeparateFields()
for /r %%a in (*.TOD) do >> ".\%%~na.avs" ECHO SelectEven()
for /r %%a in (*.TOD) do >>".\%%~na.avs" ECHO LanczosResize(1280,720)
echo AVS Scripts All Created...
echo.
echo ——————————————————————————————————
echo.

::Step 3: x264 encoding
echo Processing...You have to wait for long...
echo x264 preseted by ZZy
for /r %%a in (*.avs) do x264 --level 4.1 --preset slower --crf 18 --bframes 6 --qpmin 10 --qpmax 51 --output "%%~na.264" "%%~na.avs" 2>"%%~na_log.txt"
echo.

::Step 4: Muxing
echo Mux
echo.
echo ——————————————————————————————————
for /r %%a in (*.264) do mp4box -add "%%~na.264:fps=25" -add "%%~na PID 1021 L2 2ch 48 384 DELAY 0ms.mp2" "%%~na.mp4"
echo.
echo mp4 files created. Mission Accomplished!! Please check your encoded clips.
echo.
del *.d2v
del *.dga
del *.264
del *.txt
pause