del *.avc
del *.dga
del *.ac3
del *.wav
del *.avs
del *.log

for %%a in ("*.mts") do xport -h "%%a" 1 1 1 && ren bits0001.mpa "%%~na.ac3" &&  ren bits0001.mpv "%%~na.avc"

for %%b in ("*.avc") do DGAVCIndex -i "%%b" -o "%%~nb.dga" -e

for %%c in ("*.ac3") do azid "%%c" "%%~nc.wav"

for %%a in ("*.dga") do @echo loadplugin("dgavcdecode.dll") > "%%~na.avs"
for %%a in ("*.dga") do @echo loadplugin("audiolimiter.dll") >> "%%~na.avs"
for %%a in ("*.dga") do @echo video=AVCSource("%%a",deblock=false) >> "%%~na.avs"
for %%a in ("*.dga") do @echo audio=wavsource("%%~na.wav").convertaudiotofloat().normalize(0.95).wavgainlimiter(1.5) >> "%%~na.avs"
for %%a in ("*.dga") do @echo audiodub(video,audio) >> "%%~na.avs"
for %%a in ("*.dga") do @echo separatefields().selecteven() >> "%%~na.avs"
for %%a in ("*.dga") do @echo Lanczos4Resize(720,400) >> "%%~na.avs"




del *.log

for %%a in ("*.avs") do ffmpeg.exe -i "%%a" -threads auto -vcodec xvid -s 720x400 -maxrate 3800k -b 3000k -qmin 3 -qmax 5 -bufsize 4096 -acodec mp3 -ar 48000 -ab 160k -ac 2 -y "%%~na_xvid.avi"
