Hi,
kindly I ask you this:
I would like change this batch. Now it accept only .avi (also drag and dropped) file and
if .avi is SD720x576 it do a transcode from choosed .avi to .mp4
if .avi is HD 1920x1080 it a transcode from choosed .avi to mp4 in another mode
Should I change it so:
file drag and drop can be a .mxf and
if it is .mxf is SD do a procedure1
if it is .mxf is HD do a procedure2
How have I to modify it? thanks
Code:@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off SetLocal DisableDelayedExpansion Set "EXTLIST=*.avi" Set "DoPop=0" Set "ARGLVL=0" Set "FileName-DQ=" Set VDM_LOC="v:\automazioneclip\VirtualDubMOD\virtualdubmod.exe" set "DestFolder=." Set "WorkFolder=%DestFolder%" if not exist %DestFolder% mkdir %DestFolder% rem process the arguments one by one :ARGS rem if there are no further arguments then exit the batch. if [%1]==[] ( if "%ARGLVL%"=="0" ( CALL :GetTargetName EndLocal pause ) goto :eof ) rem wildcard processing Set "FileName=%~1" if "%FileName%"=="" ( SHIFT goto :ARGS ) rem if the argument doesn't exist in the file system in any form skip it. if NOT EXIST %1 ( SHIFT goto :ARGS ) if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" ( for %%w in (%1) DO ( Set /a ARGLVL+=1 CALL :ARGS "%%~fw" Set /a ARGLVL-=1 ) SHIFT goto :ARGS ) Set "FileName=" rem Set search/recursion variables Set "Pattern=%EXTLIST%" Set "STARTLVL=0" Set "FOUNDLVL=1024" rem if the argument is the current directory then process everything in it. if "%~f1"=="%CD%" ( rem echo Processing Directory "%CD%" CALL :START %1 SHIFT goto :ARGS ) rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file. Then return to starting directory. Type NUL pushd "%~f1" 2> nul if NOT "%errorlevel%"=="0" ( if NOT "%CD%\"=="%~dp1" ( pushd "%~dp1" Set "DoPop=1" ) Set Pattern="%~nx1" ) else ( rem echo Processing Directory "%~f1" Set "DoPop=1" ) CALL :START %1 if "%DoPop%"=="1" ( popd Set "DoPop=0" ) SHIFT goto :ARGS :START <CURRENT_ARG> rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes Set "Count=0" rem Process all files in the current directory fitting the arguments search pattern. for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do ( if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy" ) rem if it didn't find anything search all directories instead goto :eof if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% ( for /d %%b in (*) do ( pushd "%%~fb" rem echo Processing Directory "%%~fb" Set /a STARTLVL+=1 CALL :START "%%~fb" Set /a STARTLVL-=1 popd ) ) goto :eof :Process_File <AVI_FILENAME> Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" echo Processing "%CD%\%~nx1" if /I NOT "%~x1"==".avi" ( echo "%~nx1" echo is not a .avi file pause goto :eof ) ) SetLocal DisableDelayedExpansion if exist "%~dpn1.wav" ( set "Audio=%~dpn1.wav" ) else ( set "Audio=v:\automazioneclip\system\empty.wav") rem Find TimeCode Info Set AUCount=0; for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdubmod\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,codec_tag_string^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~1" 2^>^&1') DO ( if "%%~g"=="TAG:company_name" set "T_Company_Name=%%~h" if "%%~g"=="TAG:product_name" set "T_Product_Name=%%~h" if "%%~g"=="TAG:product_version" set "T_Product_Version=%%~h" if "%%~g"=="TAG:timecode" set "TIMECODE=%%~h" if "%%~g"=="width" set "V_Width=%%~h" if "%%~g"=="height" set "V_Height=%%~h" if "%%~g"=="sample_aspect_ratio" set "V_PAR=%%~h" if "%%~g"=="codec_tag_string" set "codec_tag_string=%%~h" if "%%~g"=="codec_type" if "%%~h"=="audio" set /a AUCount+=1 ) if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%codec_tag_string%"=="" ( echo ERROR: no codec tag FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%V_PAR%"=="" ( echo ERROR: Video PAR NOT FOUND! pause goto :eof ) rem Set "V_Q=UD" rem if %V_Width% LEQ 1920 if %V_Height% LEQ 1120 \\ Set "V_Q=HD" rem if %V_Width% LEQ 1280 if %V_Height% LEQ 752 Set "V_Q=MD" if %V_Width% LEQ 1024 if %V_Height% LEQ 608 Set "V_Q=SD" echo Using %V_Q% Mode echo PAR = %V_PAR% if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE% if "%V_Q%"=="SD" ( if "%codec_tag_string%"=="YUY2" (CALL :MAKEVCF_SDYUY2 "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%codec_tag_string%"=="UYVY" (CALL :MAKEVCF_SDUYVY "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%codec_tag_string%"=="MJPG" (CALL :MAKEVCF_SDMJPG "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") ) if "%V_Q%"=="HD" ( if "%codec_tag_string%"=="YUY2" (CALL :MAKEVCF_HDYUY2 "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%codec_tag_string%"=="UYVY" (CALL :MAKEVCF_HDUYVY "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") if "%codec_tag_string%"=="MJPG" (CALL :MAKEVCF_HDMJPG "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1") ) rem CALL :MAKEVCF "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :MAKEVCF_SDYUY2 <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME> rem la commandline semplice qui sotto usa solo ffmbc ma coi file esportati in uncompressed di SR o Blade ffmbc dà un errore di struttura ODML per cui si usa la commandline complessa in pipe che sta immediatamente sotto rem v:\automazioneclip\core\ffmbc -y -i "%CD%\%~n1.avi" -i "%Audio%" -vol 100 -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuv422p -an -f rawvideo -| v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 720x576 -r 25 -i - -tff -i "%Audio%" -vol 100 -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -i "%Audio%" -c:v libx264 -pix_fmt yuv422p -profile:v high422 -level:v 3 -g 33 -bf 1 -crf 18 -flags +ildct+ilme -c:a libvo_aacenc -b:a 256k -aspect 16:9 %WorkFolder%\%~n1.mp4 v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -i "%Audio%" -c:v libx264 -profile:v main -level:v 3 -g 33 -bf 0 -crf 18 -vf scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -flags +ilme+ildct -top 1 -x264opts tff=1 -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1perTgrBologna.mp4 goto :eof :MAKEVCF_SDUYVY <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME> v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuv422p -an -f rawvideo -| v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 720x576 -r 25 -i - -tff -i "%Audio%" -vol 100 -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -i "%Audio%" -c:v libx264 -pix_fmt yuv422p -profile:v high422 -level:v 3 -g 33 -bf 1 -crf 18 -flags +ildct+ilme -x264opts tff=1:ref=1 -c:a libvo_aacenc -b:a 256k -aspect 16:9 %WorkFolder%\%~n1.mp4 v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -i "%Audio%" -c:v libx264 -profile:v main -level:v 3 -g 33 -bf 0 -crf 18 -vf scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -flags +ilme+ildct -top 1 -x264opts tff=1:vbv-maxrate=10000:vbv-bufsize=10000 -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1perTgrBologna.mp4 goto :eof :MAKEVCF_SDMJPG <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME> v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuvj422p -an -f rawvideo -| v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 720x576 -r 25 -i - -tff -i "%Audio%" -vol 100 -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -i "%Audio%" -c:v libx264 -profile:v high422 -level:v 3 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -pix_fmt yuv422p -filter_complex scale=interl=1:in_range=tv:out_range=tv -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1.mp4 v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -i "%Audio%" -c:v libx264 -profile:v main -level:v 3 -g 33 -bf 0 -crf 18 -pix_fmt yuv420p -vf scale=interl=1:in_range=tv:out_range=tv -flags +ilme+ildct -top 1 -x264opts tff=1:ref=1:colorprim=bt470bg:transfer=bt470bg:colormatrix=bt470bg:vbv-maxrate=40000:vbv-bufsize=30000 -c:a libvo_aacenc -b 192k -aspect 16:9 %WorkFolder%\%~n1perTgrBolognaAAC.mp4 goto :eof :MAKEVCF_HDYUY2 <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME> rem la commandline semplice qui sotto usa solo ffmbc ma coi file esportati in uncompressed di SR o Blade ffmbc dà un errore di struttura ODML per cui si usa la commandline complessa in pipe che sta immediatamente sotto rem v:\automazioneclip\core\ffmbc -y -i "%CD%\%~n1.avi" -i "%Audio%" -vol 100 -target imx50 -aspect 16:9 %WorkFolder%\%~n1.mxf rem v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuv422p -an -f rawvideo -| v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 1920x1080 -r 25 -i - -tff -i "%Audio%" -vol 100 -target xdcamhd422 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -c:v libx264 -profile:v high422 -level:v 4.1 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -top 1 -x264opts tff=1:ref=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:vbv-maxrate=40000:vbv-bufsize=30000 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1.mp4 v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -c:v libx264 -profile:v main -level:v 4.1 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -x264opts tff=1:ref=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:vbv-maxrate=40000:vbv-bufsize=30000 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1HDperTgrBologna.mp4 goto :eof :MAKEVCF_HDUYVY <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME> rem v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuv422p -an -f rawvideo -| v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 1920x1080 -r 25 -i - -tff -i "%Audio%" -vol 100 -target xdcamhd422 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -c:v libx264 -profile:v high422 -level:v 4.1 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -top 1 -x264opts tff=1:ref=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:vbv-maxrate=40000:vbv-bufsize=30000 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1.mp4 v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -c:v libx264 -profile:v main -level:v 4.1 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -x264opts tff=1:ref=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:vbv-maxrate=40000:vbv-bufsize=30000 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1HDperTgrBologna.mp4 goto :eof :MAKEVCF_HDMJPG <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <avi_FILENAME> rem v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -pix_fmt yuv422p -an -f rawvideo -| v:\automazioneclip\core\ffmbc.exe -y -f rawvideo -pix_fmt yuv422p -s 1920x1080 -r 25 -i - -tff -i "%Audio%" -vol 100 -target xdcamhd422 -aspect 16:9 %WorkFolder%\%~n1.mxf v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -c:v libx264 -profile:v high422 -level:v 4.1 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -top 1 -x264opts tff=1:ref=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:vbv-maxrate=40000:vbv-bufsize=30000 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv422p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1.mp4 v:\automazioneclip\core\ffmpeg.exe -y -i "%CD%\%~n1.avi" -c:v libx264 -profile:v main -level:v 4.1 -g 33 -bf 0 -crf 18 -flags +ildct+ilme -x264opts tff=1:ref=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:vbv-maxrate=40000:vbv-bufsize=30000 -filter_complex crop=out_h=1080:y=0,scale=interl=1:in_range=tv:out_range=tv -pix_fmt yuv420p -c:a libvo_aacenc -b 256k -aspect 16:9 %WorkFolder%\%~n1HDperTgrBologna.mp4 goto :eof :GetTargetName Set "FileName=" Set /p FileName=InputFileName.mxf o InputFolder - INVIO per convertire tutto (EXIT esce): rem Add or remove double-quotes if necessary if NOT DEFINED FileName ( Set "FileName-DQ=" goto :DQSkip ) Set "FileName-DQ=%FileName:"=%" if NOT DEFINED FileName-DQ ( Set "FileName=" Set "FileName-DQ=" goto :DQSkip ) if EXIST "%FileName-DQ%" ( if "%FileName-DQ%"=="%FileName-DQ: =%" ( Set "FileName=%FileName-DQ%" ) else ( Set FileName="%FileName-DQ%" ) ) :DQSkip if /I "%FileName-DQ%"=="" Set FileName="%CD%" if /I "%FileName-DQ%"=="CD" Set FileName="%CD%" if /I "%FileName-DQ%"=="EXIT" goto :eof if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetName if DEFINED FileName ( Set /a ARGLVL+=1 CALL :ARGS %FileName% Set /a ARGLVL-=1 ) goto :GetTargetName
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
-
It was discussed already, it perhaps did not sink in , you have to have some utility that can recognize width for video, I use mediainfo for example,
https://forum.videohelp.com/threads/364167-%28dos-batch%29-findstr-into-xdcamhd-and-imx...=1#post2318054 -
its only necessary that the batch accepts .mxf, I think it's possible using the ffprobe but I'm not able to modify it
-
that script is so thorough, nice to learn how to process a video, what I can tell you before ndjamena can correct that, that actual action (encoding) starts with those lebels like :MAKEVCF_SDYUY2, so you can put some condition over there,
if %V_Width% GTR 720 goto :HD_process
: SD process
wait a minute, he split processes even before encoding depending on resolution , but sorts it out for width less then 1024, ..., better wait for ndjamenaLast edited by _Al_; 6th Jul 2014 at 16:13.
-
thanks, I'm waiting for ndjamena ^^
[Attachment 26178 - Click to enlarge]