add lines:
type %2
pause
after script is created in batch and you can see right away what script was really created, what characters should be escaped with ^ and therefore be really present in your script, etc.
"(" or ")" does not have to be escaped,
EDITops, apparently %2 cannot be printed by type or echo, so replace %2 temporarily with something like temp.tmp and then print it in command prompt window with: type temp.tmp
, there might be better solution to print that %2, but anyway ...
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 31 to 60 of 64
Thread
-
Last edited by _Al_; 1st Sep 2014 at 14:38.
-
-
^( ?
however this seems works (help me my cat)
Code:echo FFVideoSource^(%4^)>%2 echo src = last >>%2 echo src = src.width==720^&^&src.height==608?src.crop^(0,32,0,0^):src >>%2 echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2 echo src = src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2 echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2 echo Clip>>%2 echo SeparateFields^(^)>>%2 echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2 echo E = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0, Shift^)>>%2 echo O = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -Shift^)>>%2 echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, 2*Shift^)>>%2 echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2 echo Interleave^(E, O^)>>%2 echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2 echo Weave^(^)>>%2 echo } >>%2 echo AssumeTFF^(^)>>%2 echo SeparateFields^(^)>>%2 echo Ev=SelectEven^(^).sharpen(0.20^)>>%2 echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2 echo Interleave^(Ev,Od^)>>%2 echo Weave^(^)>>%2 echo src.framerate^<26 ? src:src.AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2 echo ChangeFPS^(25^)>>%2 echo AssumeFPS^(25^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2
-
so that:
Code:@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off SetLocal DisableDelayedExpansion Set "EXTMP4=*.mp4" Set "DoPop=0" Set "ARGLVL=0" Set "FileName-DQ=" Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe" set "DestFolder=." Set "WorkFolder=%DestFolder%" rem process the arguments one by one :ARGSMP4 rem if there are no further arguments then exit the batch. if [%1]==[] ( if "%ARGLVL%"=="0" ( CALL :GetTargetNameMP4 EndLocal pause ) goto :eof ) rem wildcard processing Set "FileName=%~1" if "%FileName%"=="" ( SHIFT goto :ARGSMP4 ) rem if the argument doesn't exist in the file system in any form skip it. if NOT EXIST %1 ( SHIFT goto :ARGSMP4 ) if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" ( for %%w in (%1) DO ( Set /a ARGLVL+=1 CALL :ARGSMP4 "%%~fw" Set /a ARGLVL-=1 ) SHIFT goto :ARGSMP4 ) Set "FileName=" rem Set search/recursion variables Set "Pattern=%EXTMP4%" 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 :STARTMP4 %1 SHIFT goto :ARGSMP4 ) 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 :STARTMP4 %1 if "%DoPop%"=="1" ( popd Set "DoPop=0" ) SHIFT goto :ARGSMP4 :STARTMP4 <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_MP4 "%%~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 :STARTMP4 "%%~fb" Set /a STARTLVL-=1 popd ) ) goto :eof :Process_MP4 <AVI_FILENAME> Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" echo Processing "%CD%\%~nx1" if /I NOT "%~x1"==".MP4" ( echo "%~nx1" echo is not a .mp4 file rem pause rem 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 -select_streams v:0 -show_entries stream^=codec_type^,r_frame_rate^,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"=="r_frame_rate" set "Frame_Rate=%%~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_type" if "%%~h"=="audio" set /a AUCount+=1 ) if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%Frame_Rate%"=="" ( echo ERROR: Frame_Rate 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% echo Frame_Rate = %Frame_Rate% if "%TimeCode%"=="" echo Warning! no TimeCode Found! if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE% CALL :MakeAVI "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :MakeAVI <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MP4_FILENAME> v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i "%CD%\%~n1.mp4" -filter_complex "[0:1] volume=1.8" -c:a pcm_s16le %WorkFolder%\%~n1.wav echo *** da File MP4 (varie risoluzioni) 25 o 50fps a MorganMJPEG AVI HD 1920x1080 interlacciato a 25fps *** rem ***Make The .vcf Script File*** echo VirtualDub.audio.SetSource^(0^)^;>%1 echo VirtualDub.audio.SetMode^(0^)^;>>%1 echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^)^;>>%1 echo VirtualDub.audio.SetClipMode^(1,1^)^;>>%1 echo VirtualDub.audio.SetEditMode^(1^)^;>>%1 echo VirtualDub.audio.SetConversion^(0,0,0,0,0^)^;>>%1 echo VirtualDub.audio.SetVolume^(^)^;>>%1 echo VirtualDub.audio.SetCompression^(^)^;>>%1 echo VirtualDub.audio.EnableFilterGraph^(0^)^;>>%1 echo VirtualDub.video.SetInputFormat^(11^)^;>>%1 echo VirtualDub.video.SetOutputFormat^(11^)^;>>%1 echo VirtualDub.video.SetMode^(1^)^;>>%1 echo VirtualDub.video.SetSmartRendering^(0^)^;>>%1 echo VirtualDub.video.SetPreserveEmptyFrames^(0^)^;>>%1 echo VirtualDub.video.SetFrameRate2^(0,0,1^)^;>>%1 echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^)^;>>%1 echo VirtualDub.video.SetCompression^(0x31626d64,0,10000,0^)^;>>%1 echo VirtualDub.video.filters.Clear^(^)^;>>%1 echo VirtualDub.audio.filters.Clear^(^)^;>>%1 echo VirtualDub.SaveAVI^("%CD%\%~n1.avi"^)^;>>%1 echo VirtualDub.Close^(^)^;>>%1 rem ***Make The .avs Script File*** echo FFVideoSource^(%4^)>%2 echo src = last >>%2 echo src = src.width==720^&^&src.height==608?src.crop^(0,32,0,0^):src >>%2 echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2 echo src = src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2 echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2 echo Clip>>%2 echo SeparateFields^(^)>>%2 echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2 echo E = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0, Shift^)>>%2 echo O = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -Shift^)>>%2 echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, 2*Shift^)>>%2 echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2 echo Interleave^(E, O^)>>%2 echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2 echo Weave^(^)>>%2 echo } >>%2 echo AssumeTFF^(^)>>%2 echo SeparateFields^(^)>>%2 echo Ev=SelectEven^(^).sharpen(0.20^)>>%2 echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2 echo Interleave^(Ev,Od^)>>%2 echo Weave^(^)>>%2 echo src.framerate^<26 ? src:src.AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2 echo ChangeFPS^(25^)>>%2 echo AssumeFPS^(25^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 echo processing source file %4 rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%CD%\%~n1.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1.avi" -u MJPG -d MJPG echo %CD% echo %4 DEL %CD%\*.ffindex DEL %CD%\*.VCF pause goto :eof :MakeMP425FpSIMXDVCAMtoHD <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MXF_FILENAME> v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i "%CD%\%~n1.mp4" -filter_complex "[0:1] volume=1.8" -c:a pcm_s16le %WorkFolder%\%~n1.wav echo *** da File MP4 (varie risoluzioni) 50fps a MorganMJPEG AVI SD 720x576 interlacciato a 25fps *** rem ***Make The .vcf Script File*** echo VirtualDub.audio.SetSource^(0^)^;>%1 echo VirtualDub.audio.SetMode^(0^)^;>>%1 echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^)^;>>%1 echo VirtualDub.audio.SetClipMode^(1,1^)^;>>%1 echo VirtualDub.audio.SetEditMode^(1^)^;>>%1 echo VirtualDub.audio.SetConversion^(0,0,0,0,0^)^;>>%1 echo VirtualDub.audio.SetVolume^(^)^;>>%1 echo VirtualDub.audio.SetCompression^(^)^;>>%1 echo VirtualDub.audio.EnableFilterGraph^(0^)^;>>%1 echo VirtualDub.video.SetInputFormat^(11^)^;>>%1 echo VirtualDub.video.SetOutputFormat^(11^)^;>>%1 echo VirtualDub.video.SetMode^(3^)^;>>%1 echo VirtualDub.video.SetSmartRendering^(0^)^;>>%1 echo VirtualDub.video.SetPreserveEmptyFrames^(0^)^;>>%1 echo VirtualDub.video.SetFrameRate2^(0,0,1^)^;>>%1 echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^)^;>>%1 echo VirtualDub.video.SetCompression^(0x6a6d7674,0,10000,0^)^;>>%1 echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAAgAAAAgAAAACAAAAAQAAAA=="^)^;>>%1 echo VirtualDub.video.filters.Clear^(^)^;>>%1 echo VirtualDub.video.filters.Add^("null transform"^)^;>>%1 echo VirtualDub.video.filters.instance[0].SetClipping^(0,32,0,0^)^;>>%1 echo VirtualDub.audio.filters.Clear^(^)^;>>%1 echo VirtualDub.SaveAVI^("%CD%\%~n1.avi"^)^;>>%1 echo VirtualDub.Close^(^)^;>>%1 rem ***Make The .avs Script File*** echo LoadCPlugin^("C:\ProgramFiles\AviSynth\plugins\yadif.dll"^)>%2 echo FFVideoSource^(%4^)>>%2 echo IResize(720,576^)>>%2 echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2 echo Clip>>%2 echo SeparateFields^(^)>>%2 echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2 echo E = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0, Shift^)>>%2 echo O = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -Shift^)>>%2 echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, 2*Shift^)>>%2 echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2 echo Interleave^(E, O^)>>%2 echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2 echo Weave^(^)>>%2 echo } >>%2 echo AssumeTFF^(^)>>%2 echo SeparateFields^(^)>>%2 echo Ev=SelectEven^(^).sharpen(0.20^)>>%2 echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2 echo Interleave^(Ev,Od^)>>%2 echo Weave^(^)>>%2 echo AssumeFPS^(25^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 echo processing source file %CD%\%~n1.mxf rem ***Call VirtualDub[Mod] if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 if NOT "%ERRORLEVEL%"=="0" ( echo WARNING!!! VirtualDubMod Error Detected!!! pause ) for %%v in (%3) do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) rem v:\automazioneclip\virtualdub\cfourcc.exe -i %3 -u MJPG -d MJPG DEL %CD%\*.FFINDEX DEL %CD%\*.VCF goto :eof :GetTargetNameMP4 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 :DQSkipMXF ) Set "FileName-DQ=%FileName:"=%" if NOT DEFINED FileName-DQ ( Set "FileName=" Set "FileName-DQ=" goto :DQSkipMXF ) if EXIST "%FileName-DQ%" ( if "%FileName-DQ%"=="%FileName-DQ: =%" ( Set "FileName=%FileName-DQ%" ) else ( Set FileName="%FileName-DQ%" ) ) :DQSkipMXF 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 :GetTargetNameMXF if DEFINED FileName ( Set /a ARGLVL+=1 CALL :ARGSMXF %FileName% Set /a ARGLVL-=1 ) goto :GetTargetNameMXF
-
a little corrected ^& semplified:
Code:@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off SetLocal DisableDelayedExpansion Set "EXTLIST=*.mxf *.avi" *.mp4" Set "DoPop=0" Set "ARGLVL=0" Set "FileName-DQ=" Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe" set "DestFolder=." Set "WorkFolder=%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 :STARTMP4 "%%~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"==".MP4" ( echo "%~nx1" echo is not a .mp4 file rem pause rem 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 -select_streams v:0 -show_entries stream^=codec_type^,r_frame_rate^,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"=="r_frame_rate" set "Frame_Rate=%%~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_type" if "%%~h"=="audio" set /a AUCount+=1 ) if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%Frame_Rate%"=="" ( echo ERROR: Frame_Rate 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% echo Frame_Rate = %Frame_Rate% if "%TimeCode%"=="" echo Warning! no TimeCode Found! if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE% CALL :Make_File "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :Make_File <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MP4_FILENAME> v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i "%CD%\%~n1.mp4" -filter_complex "[0:1] volume=1.8" -c:a pcm_s16le %WorkFolder%\%~n1.wav echo *** da File MP4 (varie risoluzioni) 25 o 50fps a MorganMJPEG AVI HD 1920x1080 interlacciato a 25fps *** rem ***Make The .vcf Script File*** echo VirtualDub.audio.SetSource^(0^)^;>%1 echo VirtualDub.audio.SetMode^(0^)^;>>%1 echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^)^;>>%1 echo VirtualDub.audio.SetClipMode^(1,1^)^;>>%1 echo VirtualDub.audio.SetEditMode^(1^)^;>>%1 echo VirtualDub.audio.SetConversion^(0,0,0,0,0^)^;>>%1 echo VirtualDub.audio.SetVolume^(^)^;>>%1 echo VirtualDub.audio.SetCompression^(^)^;>>%1 echo VirtualDub.audio.EnableFilterGraph^(0^)^;>>%1 echo VirtualDub.video.SetInputFormat^(11^)^;>>%1 echo VirtualDub.video.SetOutputFormat^(11^)^;>>%1 echo VirtualDub.video.SetMode^(1^)^;>>%1 echo VirtualDub.video.SetSmartRendering^(0^)^;>>%1 echo VirtualDub.video.SetPreserveEmptyFrames^(0^)^;>>%1 echo VirtualDub.video.SetFrameRate2^(0,0,1^)^;>>%1 echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^)^;>>%1 echo VirtualDub.video.SetCompression^(0x31626d64,0,10000,0^)^;>>%1 echo VirtualDub.video.filters.Clear^(^)^;>>%1 echo VirtualDub.audio.filters.Clear^(^)^;>>%1 echo VirtualDub.SaveAVI^("%CD%\%~n1.avi"^)^;>>%1 echo VirtualDub.Close^(^)^;>>%1 rem ***Make The .avs Script File*** echo FFVideoSource^(%4^)>%2 echo src = last >>%2 echo src = src.width==720^&^&src.height==608?src.crop^(0,32,0,0^):src >>%2 echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2 echo src = src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2 echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2 echo Clip>>%2 echo SeparateFields^(^)>>%2 echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2 echo E = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0, Shift^)>>%2 echo O = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -Shift^)>>%2 echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, 2*Shift^)>>%2 echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2 echo Interleave^(E, O^)>>%2 echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2 echo Weave^(^)>>%2 echo } >>%2 echo AssumeTFF^(^)>>%2 echo SeparateFields^(^)>>%2 echo Ev=SelectEven^(^).sharpen(0.20^)>>%2 echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2 echo Interleave^(Ev,Od^)>>%2 echo Weave^(^)>>%2 echo src.framerate^<26 ? src:src.AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2 echo ChangeFPS^(25^)>>%2 echo AssumeFPS^(25^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 echo processing source file %4 rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%CD%\%~n1.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1.avi" -u MJPG -d MJPG DEL %CD%\*.ffindex DEL %CD%\*.VCF pause goto :eof :GetTargetName Set "FileName=" Set /p FileName=InputFileName .mxf .mp4 or .avi or 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
-
Code:
@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off SetLocal DisableDelayedExpansion Set "EXTLIST=*.mxf *.avi" *.mp4" Set "DoPop=0" Set "ARGLVL=0" Set "FileName-DQ=" Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe" set "DestFolder=." Set "WorkFolder=%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 :STARTMP4 "%%~fb" Set /a STARTLVL-=1 popd ) ) goto :eof :Process_File <AVI_FILENAME> Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" echo Processing "%CD%\%~nx1" rem if /I NOT "%~x1"==".MP4" ( echo "%~nx1" echo is not a .mp4 file rem pause rem 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 -select_streams v:0 -show_entries stream^=codec_type^,r_frame_rate^,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"=="r_frame_rate" set "Frame_Rate=%%~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_type" if "%%~h"=="audio" set /a AUCount+=1 ) if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%Frame_Rate%"=="" ( echo ERROR: Frame_Rate 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% echo Frame_Rate = %Frame_Rate% if "%TimeCode%"=="" echo Warning! no TimeCode Found! if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE% CALL :Make_File "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :Make_File <VCF_FILENAME> <AVS_FILENAME> <AVI_FILENAME> <MP4_FILENAME> v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i "%CD%\%~n1.mp4" -filter_complex "[0:1] volume=1.8" -c:a pcm_s16le %WorkFolder%\%~n1.wav echo *** da File .mxf .avi .mp4 (varie risoluzioni e fps) a MorganMJPEG AVI SD 720x576i@25fps *** rem ***Make The .vcf Script File*** echo VirtualDub.audio.SetSource^(0^)^;>%1 echo VirtualDub.audio.SetMode^(0^)^;>>%1 echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^)^;>>%1 echo VirtualDub.audio.SetClipMode^(1,1^)^;>>%1 echo VirtualDub.audio.SetEditMode^(1^)^;>>%1 echo VirtualDub.audio.SetConversion^(0,0,0,0,0^)^;>>%1 echo VirtualDub.audio.SetVolume^(^)^;>>%1 echo VirtualDub.audio.SetCompression^(^)^;>>%1 echo VirtualDub.audio.EnableFilterGraph^(0^)^;>>%1 echo VirtualDub.video.SetInputFormat^(11^)^;>>%1 echo VirtualDub.video.SetOutputFormat^(11^)^;>>%1 echo VirtualDub.video.SetMode^(1^)^;>>%1 echo VirtualDub.video.SetSmartRendering^(0^)^;>>%1 echo VirtualDub.video.SetPreserveEmptyFrames^(0^)^;>>%1 echo VirtualDub.video.SetFrameRate2^(0,0,1^)^;>>%1 echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^)^;>>%1 echo VirtualDub.video.SetCompression^(0x6a6d7674,0,10000,0^)^;>>%1 echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAAgAAAAgAAAACAAAAAQAAAA=="^)^;>>%1 echo VirtualDub.video.filters.Clear^(^)^;>>%1 echo VirtualDub.audio.filters.Clear^(^);>>%1 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^)^;>>%1 echo VirtualDub.Close^(^)^;>>%1 rem ***Make The .avs Script File*** echo FFVideoSource^(%4^)>%2 echo src = last >>%2 echo src = src.width==720^&^&src.height==608?src.crop^(0,32,0,0^):src >>%2 echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2 echo src = src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2 echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2 echo Clip>>%2 echo SeparateFields^(^)>>%2 echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2 echo E = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0, Shift^)>>%2 echo O = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -Shift^)>>%2 echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, 2*Shift^)>>%2 echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2 echo Interleave^(E, O^)>>%2 echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2 echo Weave^(^)>>%2 echo } >>%2 echo AssumeTFF^(^)>>%2 echo SeparateFields^(^)>>%2 echo Ev=SelectEven^(^).sharpen(0.20^)>>%2 echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2 echo Interleave^(Ev,Od^)>>%2 echo Weave^(^)>>%2 echo src.framerate^<26 ? src:src.AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2 echo ChangeFPS^(25^)>>%2 echo AssumeFPS^(25^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 echo processing source file %4 rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%DestFolder%\\%~n1_SD.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG DEL %DestFolder%\*.ffindex DEL %DestFolder%\*.VCF goto :eof :GetTargetName Set "FileName=" Set /p FileName=InputFileName .mxf .mp4 or .avi or 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
-
Please can I wonder a question?
I have insert this code into the batch
Code:rem *** TRY extract audio from IMX SD FILES *** v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1.wav v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.2 -map_channel 0.1.3 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1ch3ch4.wav rem *** TRY extract audio from XDCAMHD FILES *** v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1.wav v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1ch3ch4.wav rem *** TRY extract audio from MP4 gopro *** v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -filter_complex "[0:1] volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1.wav
rem *** TRY extract audio from IMX SD FILES ***
IF SOURCE FILE [%4] IS A .MXF FILE AND IF RESOLUTION IS 720X608 -----GO HERE---> v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dBrecision=fixed" %DestFolder%\%~n1.wav
How can I do it?
thanks -
to follow batch variable syntax logic, %~x4 should be file extension, like .mxf, %4 is the whole name - drive, path, name and extension
-
Ah thanks, so if I have to tell to the script that:
if file processed have .mxf extension ---> do that
how I have to change the code? -
I have try:
Code:if "%~x4"==".mxf" do (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1.wav)
-
that condition should work, small steps then, try that condition first:
if "%~x4"==".mxf" echo condition works & pause -
"(" and ")" do need to be escaped if they're not contained within quotes, ")" especially needs to be escaped when used within if/for parentheses. Anyway, it's good practice to escape them by default since they are syntax operators.
%2 expands to the output file name, but if you wanted to literally display "%2" you'd escape it as %%2.
if "%~x4"==".mxf"
You already have a similar line in your script, you've even edited it. Maybe you should give more thought into what each line of code actually does. -
Code:
@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO on SetLocal DisableDelayedExpansion Set "EXTLIST=*.* Set "DoPop=0" Set "ARGLVL=0" Set "FileName-DQ=" Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe" set "DestFolder=." Set "WorkFolder=%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 :STARTMP4 "%%~fb" Set /a STARTLVL-=1 popd ) ) goto :eof :Process_File <FILENAME> Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" 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 -select_streams v:0 -show_entries stream^=codec_type^,r_frame_rate^,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"=="r_frame_rate" set "Frame_Rate=%%~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_type" if "%%~h"=="audio" set /a AUCount+=1 ) if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%Frame_Rate%"=="" ( echo ERROR: Frame_Rate 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% echo Frame_Rate = %Frame_Rate% if "%TimeCode%"=="" echo Warning! no TimeCode Found! if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE% CALL :Make_File "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :Make_File <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME> rem *** TRY extract audio from IMX SD FILES *** v:\automazioneclip\core\ffmpeg.exe -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1.wav v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.2 -map_channel 0.1.3 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1ch3ch4.wav rem *** TRY extract audio from XDCAMHD FILES *** v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1.wav v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1ch3ch4.wav rem *** TRY extract audio from MP4 and other files *** v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1.wav echo *** from various format to MorganMJPEG AVI SD 720x576i@25fps *** rem ***Make The .vcf Script File*** echo VirtualDub.audio.SetSource^(0^)^;>%1 echo VirtualDub.audio.SetMode^(0^)^;>>%1 echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^)^;>>%1 echo VirtualDub.audio.SetClipMode^(1,1^)^;>>%1 echo VirtualDub.audio.SetEditMode^(1^)^;>>%1 echo VirtualDub.audio.SetConversion^(0,0,0,0,0^)^;>>%1 echo VirtualDub.audio.SetVolume^(^)^;>>%1 echo VirtualDub.audio.SetCompression^(^)^;>>%1 echo VirtualDub.audio.EnableFilterGraph^(0^)^;>>%1 echo VirtualDub.video.SetInputFormat^(11^)^;>>%1 echo VirtualDub.video.SetOutputFormat^(11^)^;>>%1 echo VirtualDub.video.SetMode^(1^)^;>>%1 echo VirtualDub.video.SetSmartRendering^(0^)^;>>%1 echo VirtualDub.video.SetPreserveEmptyFrames^(0^)^;>>%1 echo VirtualDub.video.SetFrameRate2^(0,0,1^)^;>>%1 echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^)^;>>%1 echo VirtualDub.video.SetCompression^(0x6a6d7674,0,10000,0^)^;>>%1 echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAAAgAAAAgAAAACAAAAAQAAAA=="^)^;>>%1 echo VirtualDub.video.filters.Clear^(^)^;>>%1 echo VirtualDub.audio.filters.Clear^(^);>>%1 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^)^;>>%1 echo VirtualDub.Close^(^)^;>>%1 rem ***Make The .avs Script File*** echo FFVideoSource^(%4^)>%2 echo src = last >>%2 echo src = src.width==720^&^&src.height==608?src.crop^(0,32,0,0^):src >>%2 echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2 echo src = src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2 echo function IResize^(clip Clip, int NewWidth, int NewHeight^) {>>%2 echo Clip>>%2 echo SeparateFields^(^)>>%2 echo Shift=^(GetParity() ? -0.25 : 0.25) * ^(Height()/Float(NewHeight/2)^-1.0^)>>%2 echo E = SelectEven^(^).Spline36resize^(NewWidth, NewHeight/2, 0, Shift^)>>%2 echo O = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -Shift^)>>%2 echo Ec = SelectEven^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, 2*Shift^)>>%2 echo Oc = SelectOdd^( ^).Spline36resize^(NewWidth, NewHeight/2, 0, -2*shift^)>>%2 echo Interleave^(E, O^)>>%2 echo IsYV12^(^) ? MergeChroma^(Interleave(Ec, Oc)^) : Last >>%2 echo Weave^(^)>>%2 echo } >>%2 echo AssumeTFF^(^)>>%2 echo SeparateFields^(^)>>%2 echo Ev=SelectEven^(^).sharpen(0.20^)>>%2 echo Od=SelectOdd^(^).sharpen^(0.20^)>>%2 echo Interleave^(Ev,Od^)>>%2 echo Weave^(^)>>%2 echo src.framerate^<26 ? src:src.AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2 echo ChangeFPS^(25^)>>%2 echo AssumeFPS^(25^)>>%2 echo ConvertToYUY2^(interlaced=true^)>>%2 echo processing source file %4 rem ***Call VirtualDub*** if NOT EXIST %VD_LOC% ( echo Um, where the hell is VirtualDubMod? pause ) %VD_LOC% /min %2 /s %1 for %%v in ("%DestFolder%\\%~n1_SD.avi") do ( if %%~zv LSS 128 ( echo ERROR!!! Extra Small File Size Detected!!! pause ) ) v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG DEL %DestFolder%\*.ffindex DEL %DestFolder%\*.VCF goto :eof :GetTargetName Set "FileName=" Set /p FileName=InputFileName .mxf .mp4 or .avi or 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
if processed file is a .mxf file ---> execute only routine that try extract audio from mxf files
if processed file is a .mp4 file ---> execute only routine that try extract audio from .mp4 filesLast edited by marcorocchini; 1st Sep 2014 at 19:25.
-
sure , I tell op, to debug problem in small steps, so he could see that condition works, to look for problem elsewhere, ...anyway, thanks for explanations, to watch those parentheses is priority, sure, using echo after condition in parentheses is not working, but in my case using echo and typing it into avs file directly, no problem
-
if "%~x4"==".mxf"
no no no no this is just my thought was watching my cat looked at me thoughtfully that bad, but I do not know really how it should be the code to be correct
-
Did you try that line above?
if "%~x4"==".mxf" echo condition works & pause
and then saw your scrip ending with those two lines? :
condition works
press any key to continue ... -
Code:
rem *** TRY extract audio from IMX SD FILES *** if "%~x4"==".MXF" v:\automazioneclip\core\ffmpeg.exe -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1.wav if "%~x4"==".MXF" v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.2 -map_channel 0.1.3 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1ch3ch4.wav rem *** TRY extract audio from XDCAMHD FILES *** if "%~x4"==".MXF" v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1.wav if "%~x4"==".MXF" v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1ch3ch4.wav rem *** TRY extract audio from MP4 and other files *** if "%~x4"==".MP4" v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] volume=2.0" -c:a pcm_s16le %DestFolder%\%~n1.wav
oh cat, it seems works this but is cAsE SenSitive: in this mode if file .MXF --> the script take the .wav file
but if is .mxf --> don't take nothing ^^ -
My response took too long in the writing. I'd gone off to S64 to check on the details. :S
-
ok, use:
if /i "%~x4"==".MXF"
that /i will causes to get rid of that "case sensitive" problem -
if /i...
-Edit- I'll just go now...Last edited by ndjamena; 2nd Sep 2014 at 08:22.
-
He's a furry. It doesn't get any better even at rock bottom, folks.
-
I was trying so you as yourself to figure out, as a next step, to skip that DO thing ..., ok
if /i "%~x4"==".MXF" ( v:\automazioneclip\core\ffmpeg.exe -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dBrecision=fixed" %DestFolder%\%~n1.wav)Last edited by _Al_; 1st Sep 2014 at 21:07.
-
https://forum.videohelp.com/threads/366826-using-IF-and-OR-in-a-batch-file-%28for-****%29
the furry solution:
Code:rem *** TRY extract audio from .MXF IMX SD FILE *** Set "TokenS=0" IF "%~x4"==".MXF" Set "TokenS=1" IF "%~x4"==".mxf" Set "TokenS=1" If "%TokenS%"=="1" (if "%V_Width%"=="720" (v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1.wav)) If "%TokenS%"=="1" (if "%V_Width%"=="720" (v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.2 -map_channel 0.1.3 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1ch3ch4.wav)) rem *** TRY extract audio from .MXF XDCAM-HD 4:2:2 FILE *** Set "TokenS=0" IF "%~x4"==".MXF" Set "TokenS=1" IF "%~x4"==".mxf" Set "TokenS=1" If "%TokenS%"=="1" (if "%V_Width%"=="1920" (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le %DestFolder%\%~n1.wav)) If "%TokenS%"=="1" (if "%V_Width%"=="1920" (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le %DestFolder%\%~n1ch3ch4.wav)) rem *** TRY extract audio from .MXF OTHER TYPE *** Set "TokenS=0" IF "%~x4"==".MXF" Set "TokenS=1" IF "%~x4"==".mxf" Set "TokenS=1" If "%TokenS%"=="1" (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le %DestFolder%\%~n1.wav) If "%TokenS%"=="1" (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le %DestFolder%\%~n1ch3ch4.wav) rem *** TRY extract audio from GOPRO MP4 file *** Set "TokenS=0" IF "%~x4"==".MP4" Set "TokenS=1" IF "%~x4"==".mp4" Set "TokenS=1" If "%TokenS%"=="1" (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:1] volume=1.5" -c:a pcm_s16le %DestFolder%\%~n1.wav) rem *** TRY extract audio from .MP4 OTHER TYPE *** Set "TokenS=0" IF "%~x4"==".MP4" Set "TokenS=1" IF "%~x4"==".mp4" Set "TokenS=1" If "%TokenS%"=="1" (v:\automazioneclip\core\ffmpeg.exe -y -i %4 -filter_complex "[0:0] volume=1.5" -c:a pcm_s16le %DestFolder%\%~n1.wav)
Last edited by marcorocchini; 2nd Sep 2014 at 07:31.
-
to run a command if both conditions need to be true :
IF "%~x4"==".MXF" if "%V_Width%"=="720" (v:\automazioneclip\core\ffmpeg.exe ....... command for .MXF)
IF "%~x4"==".mxf" if "%V_Width%"=="720" (v:\automazioneclip\core\ffmpeg.exe ....... command for .mxf)
in your script you run both cases (for .mxf and for .MXF ) anyway (with proper width), you can run ffmpeg only once fixing your flag with some other value for that TokenS, like 2 or something Iif it is not used for anything else in your script)
Code:IF "%~x4"==".MXF" Set "TokenS=1" IF "%~x4"==".mxf" Set "TokenS=2" If "%TokenS%"=="1" (if "%V_Width%"=="720" (v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.0 -map_channel 0.1.1 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1.wav)) If "%TokenS%"=="2" (if "%V_Width%"=="720" (v:\automazioneclip\core\ffmpeg.exe -loglevel fatal -y -i %4 -map_channel 0.1.2 -map_channel 0.1.3 -af "volume=volume=9dB:precision=fixed" %DestFolder%\%~n1ch3ch4.wav))