VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. HII dear ndjamena

    can help a poor cat?

    I need to change the script so that when I drag and drog a entire folder to this batch file, also all the subfolder and all files in subfolders become processed.

    Can you help me? thanks ! ! !


    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off  
    
    ver | find "XP" > nul
    if %ERRORLEVEL% == 0 set "windowsXP=1"
    
    xcopy /y v:\automazioneclip\system\morgan\m3jpegHD.dll c:\windows\system32
    xcopy /y v:\automazioneclip\system\morgan\MMIJG32.dll c:\windows\system32
    xcopy /y v:\automazioneclip\system\morgan\m3jpegSD.dll c:\windows\system32
    xcopy /y v:\automazioneclip\system\x264VFW.dll c:\windows\system32
    xcopy /y v:\automazioneclip\system\pvmjpg40.dll c:\windows\system32
    xcopy /y v:\automazioneclip\system\morgan\MMIJG30.dll c:\windows\system32
    xcopy /y v:\automazioneclip\system\morgan\m3jpSD.INI c:\windows
    xcopy /y v:\automazioneclip\system\morgan\m3jpHD.ini c:\windows
    if not exist c:\windows\avfs.dll xcopy /y v:\automazioneclip\core\avfs.dll c:\windows
    pfm register c:\windows\avfs.dll
    IF "%windowsXP%"=="1" xcopy /y "v:\automazioneclip\core\senable.exe.lnk" "c:\Documents and Settings\Administrator\Menu Avvio\Programmi\Esecuzione automatica"
    
    if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\m3jpegHD.dll c:\windows\SysWOW64
    if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\MMIJG32.dll c:\windows\SysWOW64
    if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\m3jpegSD.dll c:\windows\SysWOW64
    if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\morgan\MMIJG30.dll c:\windows\SysWOW64
    if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\x264VFW.dll c:\windows\SysWOW64
    if exist c:\windows\SysWOW64 xcopy /y v:\automazioneclip\system\pvmjpg40.dll c:\windows\SysWOW64
    
    md c:\windows\spvideo
    xcopy /y v:\automazioneclip\system\wavdest.ocx c:\windows\spvideo
    xcopy /y v:\automazioneclip\system\SamplesDropper.ocx c:\windows\spvideo
    xcopy /y v:\automazioneclip\system\SP_audio.ocx c:\windows\spvideo
    xcopy /y v:\automazioneclip\system\dv_grabber.ocx c:\windows\spvideo
    xcopy /y v:\automazioneclip\system\SP_video.ocx c:\windows\spvideo
    
    regsvr32 /s c:\windows\spvideo\wavdest.ocx
    regsvr32 /s c:\windows\spvideo\SamplesDropper.ocx
    regsvr32 /s c:\windows\spvideo\SP_audio.ocx
    regsvr32 /s c:\windows\spvideo\dv_grabber.ocx
    regsvr32 /s c:\windows\spvideo\SP_video.ocx
    
    regedit /s v:\automazioneclip\system\VDreg.reg
    regedit /s v:\automazioneclip\system\PICreg.reg
    regedit /s v:\automazioneclip\system\drivers.reg
    
    cls
    
    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
    color
    	
    	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>
    color
    
    	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 <FILENAME>
    color
    
    
            IF exist "%~n1_HDavs.avi" IF exist "%~n1_HDavs.wav" (
    		echo  already processed 
    		goto :eof
    	)
    
            Set "TokenS=0"
            Set "isWAV=0"
            IF "%~x1"==".WAV" Set "TokenS=1" 
            IF "%~x1"==".wav" Set "TokenS=1"
            If "%TokenS%"=="1" (
    		echo  Questo e' un file audio!
    	        goto :eof
    	)
     
            if NOT EXIST "v:\automazioneclip\system\empty.wav" (
    		echo  v:\automazioneclip\system\empty.wav not Found! 
    		pause
    	)
    
            Set "TokenS=0"
            Set "isMXForMP4=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            IF "%~x1"==".MP4" Set "TokenS=1" 
            IF "%~x1"==".mp4" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXForMP4=1"
            If NOT "%isMXForMP4%"=="1" (
    		echo  input file non MXF o non MP4
    	        goto :eof
    	)
    
            Set "TokenS=0"
            Set "isReallyMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1"
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isReallyMXF=1"
    
            Set "SetMemoryMaxValue=16"
    
    @echo off
    
     rem Find TimeCode Info
         	Set AUCount=0;
    	for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -select_streams v:0 -show_streams -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
    	) 
    
            for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -select_streams v:0 -show_streams "%~1"') DO (
    		 if "%%~g"=="duration_ts" set "NumberOfFrame=%%~h")
    
            echo the variabile T_Company_Name assume this value "%T_Company_Name%"
            echo the variabile T_Product_Name assume this value "%T_Product_Name%"
            echo the variabile T_Product_Version assume this value "%T_Product_Version%"
            echo the variabile TIMECODE assume this value "%TIMECODE%"
            echo the variabile Frame_Rate assume this value "%Frame_Rate%"
            echo the variabile V_Width assume this value "%V_Width%"
            echo the variabile V_Height assume this value "%V_Height%"
            echo the variabile V_PAR assume this value "%V_PAR%"
            
            set /a "forVirtualDubAddRangeWhenDoubleFrameRate"=%NumberOfFrame%/2
            echo the variabile NumberOfFrame assume this value "%NumberOfFrame%" so half is echo "%forVirtualDubAddRangeWhenDoubleFrameRate%"
    
            rem #### SEARCH for durations: advanced ####
    	Set AUCount=0;
    	Set VDCount=0;
    	Set STCount=0;
    	Set "V_Number_Of_Frames="
    	for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -show_format -show_streams "%~1" 2^>^&1') DO (
    		CALL :Process_Item "%%~g" "%%~h"
    	) 
    
            if "%V_Time_Base%"=="" (
    		echo  ERROR: V_Time_Base not found, impossibile rilevare il FrameRate
    		)
    
    	if NOT "%V_Time_Base%"=="" (
    		for /F "tokens=1,2 delims=/" %%g in ("%V_Time_Base%") do (
    			set "V_Time_Base_Denom=%%~g"
    			set /a "V_Time_Base_Num=%%~h*10000"
    		)
    	)
    
            if "%V_Frame_Rate%"==""  (
    		echo  ERROR: V_Frame_Rate, impossibile rilevare il FrameRate
    		)
    
    	if NOT "%V_Frame_Rate%"=="" (
    		for /F "tokens=1,2 delims=/" %%g in ("%V_Frame_Rate%") do (
                            set /a "V_Frame_Rate_Pure=%%~g"
                            set "V_Frame_Rate_Denom_cat=%%~h*100"
    
    			set /a "V_Frame_Rate_Num=%%~g*10000"
    			set "V_Frame_Rate_Denom=%%~h"
    		)
    	)
    
    	if "%V_Number_Of_Frames%"=="" Set /a "V_Number_Of_Frames=V_Duration/((V_Time_Base_Num/V_Time_Base_Denom)/(V_Frame_Rate_Num/V_Frame_Rate_Denom))"
     
            set /a "FPSforVirtualdubX2=%V_Number_Of_Frames%"
            set /a "FPSforVirtualdubdiv2=%V_Number_Of_Frames%/2"
            set "FPSforVirtualdub=%V_Number_Of_Frames%"
    
    echo numero frame con procedura advanced is %V_Number_Of_Frames%
    
            rem #### calculate realFPS with 2 fps calculators ###
            echo WScript.Echo Eval^(WScript.Arguments^(0^)^)>"%~dp1FPScalculator1.vbs"
            echo Result=Replace^(Result,",","."^)>>"%~dp1FPScalculator1.vbs"
            echo WScript.Echo Result>>"%~dp1FPScalculator1.vbs"         
            
            IF NOT "%V_Frame_Rate_Pure%"=="" IF NOT "%V_Frame_Rate_Denom%"=="" for /f %%n in ('cscript //nologo "%~dp1FPScalculator1.vbs" "%V_Frame_Rate_Pure%/%V_Frame_Rate_Denom%"') do (set RealFPS2temp=%%n)
                 
            echo %RealFPS2temp%>"%~dp1RealFPS2temp.txt"
            v:\automazioneclip\system\fart.exe "%~dp1RealFPS2temp.txt" , "."
            set /p RealFPS2=<"%~dp1RealFPS2temp.txt"
    
            echo Numerator = WScript.Arguments^(0^)>"%~dp1FPScalculator2.vbs"
            echo Denom = WScript.Arguments^(1^)>>"%~dp1FPScalculator2.vbs"
            echo Result=Numerator/Denom>>"%~dp1FPScalculator2.vbs"                
            echo WScript.Echo Result>>"%~dp1FPScalculator2.vbs"
            echo Result=Replace^(Result,",","."^)>>"%~dp1FPScalculator2.vbs"        
            echo WScript.Echo Result>>"%~dp1FPScalculator2.vbs"
            echo Result=Round^(Numerator/Denom,2^)>>"%~dp1FPScalculator2.vbs"       
            echo Result=Replace^(Result,",","."^)>>"%~dp1FPScalculator2.vbs"        
            echo WScript.Echo Result>>"%~dp1FPScalculator2.vbs"
     
    setlocal ENABLEDELAYEDEXPANSION
            set fcount=1
            IF NOT "%V_Frame_Rate_Pure%"=="" IF NOT "%V_Frame_Rate_Denom%"=="" FOR /F "tokens=* USEBACKQ" %%F IN (`cscript /nologo "%~dp1FPScalculator2.vbs" %V_Frame_Rate_Pure% %V_Frame_Rate_Denom%`) DO (set var!fcount!=%%F
            set /a fcount=!fcount!+1
            )
            rem echo %var1%
            rem echo %var2%
            rem echo %var3%      
    
           echo %var2%>"%~dp1RealFPStemp.txt"
    endlocal
    
           set /p RealFPS=<"%~dp1RealFPStemp.txt"
    
    echo RealFPS is %RealFPS%
    echo RealFPS2 is %RealFPS2%
    
          if exist "%~dp1FPScalculator1.vbs" del "%~dp1FPScalculator1.vbs"
          if exist "%~dp1FPScalculator2.vbs" del "%~dp1FPScalculator2.vbs"
          if exist "%~dp1RealFPStemp.txt" del "%~dp1RealFPStemp.txt"
          if exist "%~dp1RealFPS2temp.txt" del "%~dp1RealFPS2temp.txt"
    
            if "%V_Width%"=="" (
    		echo  ERROR: Video Width NOT FOUND!
    		timeout /t 3
    		goto :eof
    	)
    	if "%V_Height%"=="" (
    		echo  ERROR: Video Height NOT FOUND!
    		pause
    		goto :eof
    	)
            if "%Frame_Rate%"=="" (
    		echo  ERROR: Frame_Rate NOT FOUND!
    		)
    	if "%V_PAR%"=="" (
    		echo  ERROR: Video PAR NOT FOUND!
    		pause			)
    
      
    :: This is a timed prompt with accepted parms(/C), the time and the default reply
    :: in a variable(/T), a multi-line variable to display in the prompt box(/M),
    :: and a prompt message in quotes.
    :: NOTE... each line in "msg" must end with ~^ except the last line.
    ::         Also, if the script times out, the errorlevel is 0
    :: NOTE2.. The /M value is the NAME of the variable, not the data in it.
       rem set msg=1=AudioVolume1.0~^
       rem         2=AudioVolume1.2~^
       rem         3=AudioVolume1.3~^
       rem         4=AudioVolume1.4~^
       rem         5=AudioVolume1.5~^
       rem         6=AudioVolume1.6~^
       rem         7=AudioVolume1.7~^
       rem         8=AudioVolume1.8~^
       rem         9=AudioVolume2.0~^  
       
          
    ::   rem echo %msg%
         rem set timeout=2
         rem set use_choice=cscript //NOLOGO  //T:%timeout% "v:\automazioneclip\core\choice.vbs"
         rem If "%isReallyMXF%"=="1" %use_choice% /C:123456789 /T:5,%timeout% /M:msg " %~nx1 AudioVolumeDefault "
    
       
            set "AudioVolume=1.5"
            rem if errorlevel==255 echo No such choice (255) 
            rem if not errorlevel==10 if errorlevel==9 Set "AudioVolume=1.9"       
            rem if not errorlevel==9 if errorlevel==8 Set "AudioVolume=2.0"
            rem if not errorlevel==8 if errorlevel==7 Set "AudioVolume=1.7"
            rem if not errorlevel==7 if errorlevel==6 Set "AudioVolume=1.6"
            rem if not errorlevel==6 if errorlevel==5 Set "AudioVolume=1.5"
            rem if not errorlevel==5 if errorlevel==4 Set "AudioVolume=1.4"
            rem if not errorlevel==4 if errorlevel==3 Set "AudioVolume=1.3"
            rem if not errorlevel==3 if errorlevel==2 Set "AudioVolume=1.2"
            rem if not errorlevel==2 if errorlevel==1 Set "AudioVolume=1.0"
            rem if not errorlevel==1 if errorlevel==0 echo The choice was interrupted (0)
    
    
    	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")
    
            IF exist "%DestFolder%\unicodefile.txt" DEL "%DestFolder%\unicodefile.txt"
            IF exist  "%DestFolder%\mediainfo.txt" DEL "%DestFolder%\mediainfo.txt"
    
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
            v:\automazioneclip\virtualdub\mediainfo.exe "%~dpnx1" dumpinfo:unicodefile.txt
            TYPE unicodefile.txt>mediainfo.txt
    
            findstr /c:"Codec ID                                 : 0D01030102020201-0401020202010200" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "dvcam=1")
            
            set "PROGRESSIVE=0"
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "PROGRESSIVE=1")
    
            set "doubleframrate=0"
            findstr /c:"Frame rate                               : 50.000 fps" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "doubleframrate=1")
            findstr /c:"Codec ID                                 : YUY2" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "UNCOMPRESSED=1")           
               
            set "fullHDinterlace=0" 
            set "xdcamhd422=unknown"
            set "fps=unknown"
            set "ch_sub=unknown"
            set "scanInterlace=unknown"
            findstr /c:"Format profile                           : 4:2:2@High" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd422=yes")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps25=yes")
            findstr /c:"Chroma subsampling                       : 4:2:2" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ch_sub=yes")
            findstr /c:"Scan type                                : Interlaced" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanInterlace=yes")
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanProgressive=yes")
            findstr /c:"Scan type                                : MBAFF" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanMBAFF=1")
    
            if "%xdcamhd422%"=="yes" if  "%fps25%"=="yes" if "%ch_sub%"=="yes" if "%scanInterlace%"=="yes" set "fullHDinterlace=1"
            if "%xdcamhd422%"=="yes" if  "%fps25%"=="yes" if "%ch_sub%"=="yes" if "%scanProgressive%"=="yes" set "fullHDprogressive=1"
    
            set "IMX=0"
            findstr /c:"Commercial name                          : IMX" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "IMX=1")
    
            set "MXFXDCAMHQorSP25fpsinterlaced=0"
            set "MXFXDCAMHQorSP25fpsProgressive=0"  
            set "fps25=unknown"
            set "ch_sub420=unknown"
            set "IMXorDCAM=no"
            findstr /c:"Commercial name                          : XDCAM HD 35" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd35=yes")
            findstr /c:"Commercial name                          : XDCAM HD 25" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd25=yes")
            findstr /c:"Format                                   : MPEG Video" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "mpegvideoF335=yes")
            findstr /c:"Commercial name                          : HDV 1080i" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "HDV1080i=yes")
            findstr /c:"Commercial name                          : HDV 1080p" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "HDV1080p=yes")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps25=yes")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"  
            IF NOT ERRORLEVEL 1 (set "fps25tag=1")
            findstr /c:"Chroma subsampling                       : 4:2:0" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ch_sub420=yes")
            findstr /c:"Scan type                                : Interlaced" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanInterlace=yes")
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "scanProgressive420=yes")
            findstr /c:"Width                                    : 720" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "IMXorDCAM=yes")
            if "%xdcamhd35%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanInterlace%"=="yes" set "MXFXDCAM3525fpsinterlaced=1"
            if "%HDV1080i%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanInterlace%"=="yes" set "MXFXDCAMHDV1080i25fpsinterlaced=1"
            if "%mpegvideoF335%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanInterlace%"=="yes" set "MXFXDCAMF335interlaced=1"
            set "MXFXDCAMHQorSP25fpsinterlaced=0" 
            if "%MXFXDCAM3525fpsinterlaced%"=="1" set "MXFXDCAMHQorSP25fpsinterlaced=1" 
            if "%MXFXDCAMHDV1080i25fpsinterlaced%"=="1" set "MXFXDCAMHQorSP25fpsinterlaced=1"
            if "%MXFXDCAMF335interlaced%"=="1" set "MXFXDCAMHQorSP25fpsinterlaced=1"
            if "%xdcamhd35%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" set "MXFXDCAM3525fpsProgressive=1"
            if "%xdcamhd35%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" if "%doubleframrate%"=="1" set "MXFXDCAM35_50fps_Progressive=1"
            if "%xdcamhd25%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" if "%doubleframrate%"=="1" set "MXFXDCAM25_50fps_Progressive=1"     
            if "%MXFXDCAM35_50fps_Progressive%"=="1" set "MXFXDCAM35or25_50fps_Progressive=1"
            if "%MXFXDCAM25_50fps_Progressive%"=="1" set "MXFXDCAM35or25_50fps_Progressive=1"
    
            if "%HDV1080p%"=="yes" if  "%fps25%"=="yes" if "%ch_sub420%"=="yes" if "%scanProgressive420%"=="yes" set "MXFXDCAMHDV1080p25fpsProgressive=1"       
            set "MXFXDCAMHQorSP25fpsProgressive=0" 
            if "%MXFXDCAM3525fpsProgressive%"=="1" set "MXFXDCAMHQorSP25fpsProgressive=1" 
            if "%MXFXDCAMHDV1080p25fpsProgressive%"=="1" set "MXFXDCAMHQorSP25fpsProgressive=1"
    
            set "dvcamPal=0"       
            if "%dvcam%"=="1" if "%fps25tag%"=="1" Set dvcamPal=1
    
    rem ***debugecho xdcamhd35interlacciato uguale a "%MXFXDCAM3525fpsinterlaced%"
    rem ***debug  echo HDV1080iinterlacciato uguale a "%MXFXDCAMHDV1080i25fpsinterlaced%"
    rem ***debug  echo MXFXDCAMHQorSP25fpsinterlaced "%MXFXDCAMHQorSP25fpsinterlaced%"
    rem ***debug  echo MXFXDCAM3525fpsProgressive "%MXFXDCAM3525fpsProgressive%"
    rem ***debug echo MXFXDCAMHDV1080p25fpsProgressive "%MXFXDCAMHDV1080p25fpsProgressive%"
    rem ***debug echo MXFXDCAMHQorSP25fpsProgressive "%MXFXDCAMHQorSP25fpsProgressive%"
    
            rem *** check if file is MXF and - at the same time - any HD
            Set "TokenS=0"
            Set "isMXF=0"
            set "HDformat=0"
            set "mxfHD422=0"
            set "mxfHD420=0"
            set "Ch_Sub422=unknown"
            set "Ch_Sub420=unknown"
    	if %V_Height% GEQ 720 (Set "HDformat=1")
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
            findstr /c:"Chroma subsampling                       : 4:2:2" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "Ch_Sub422=yes")
            findstr /c:"Chroma subsampling                       : 4:2:0" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "Ch_Sub420=yes")
    
            if "%isMXF%"=="1" if "%HDformat%"=="1" if "%Ch_Sub422%"=="yes" if "%PROGRESSIVE%"=="1" if "%doubleframrate%"=="1" (set "mxfHD422progressiveDoubleFrameRate=1")
            if "%fullHDinterlace%"=="1" (CALL :Make_File_HD2HDinterlace "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%fullHDProgressive%"=="1" (CALL :Make_File_HD2HDProgressive "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%mxfHD422progressiveDoubleFrameRate%"=="1" (CALL :Make_File_mxfHD422progressivemode50fps "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%MXFXDCAM35or25_50fps_Progressive%"=="1" (CALL :Make_File_MXFXDCAM35or25_50fps_Progressive "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")            
            if "%IMX%"=="1" (CALL :Make_File_IMX "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")  
            if "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" (CALL :Make_File_MXFXDCAMHQorSP25fpsinterlaced "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%MXFXDCAMHQorSP25fpsProgressive%"=="1" (CALL :Make_File_MXFXDCAMHQorSP25fpsProgressive "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%dvcamPAL%"=="1" (CALL :Make_File_dvcam_PALonly "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")  
    
            rem *** check FOR GOPRO        
            
            Set "TokenS=0"
            Set "MP4GOPRO=0"
            set "GoPROAVC=0"
            Set "gopro50fps=0"
            Set "gopro25fps=0"
            Set "gopro47fps=0"
            Set "goproProgressive=0"
            Set "gopro1920=0"
            Set "gopro1080=0"
            Set "GOpro1920x1080=0"
            IF "%~x1"==".MP4" Set "TokenS=1" 
            IF "%~x1"==".mp4" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMP4=1"
            IF "%isMP4%"=="1" (v:\automazioneclip\virtualdub\mediainfo.exe "%CD%\%~n1.mp4" dumpinfo:unicodefile.txt
            TYPE unicodefile.txt>mediainfo.txt)
            findstr /c:"Title                                    : GoPro AVC" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "GoPROAVC=1")
            if "%ismp4%"=="1" if "%Goproavc%"=="1" (set "MP4gopro=1")
            findstr /c:"Frame rate                               : 50.000 fps" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "gopro50fps=1")
            findstr /c:"Frame rate                               : 25.000 fps" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "gopro25fps=1")
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "goproProgressive=1")
            findstr /c:"Width                                    : 1 920 pixels" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "gopro1920=1")
            findstr /c:"Height                                   : 1 080 pixels" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "gopro1080=1")
    
            Set "GoPro1920x1080=0"
            IF "%gopro1920%"=="1" IF "%gopro1080%"=="1" Set "GoPro1920x1080=1"
    
            IF "%MP4gopro%"=="1" IF "%gopro50fps%"=="1" IF "%goproProgressive%"=="1" Set "MP4Gopro50fps=1"
     
            IF "%MP4Gopro50fps%"=="1" (CALL :MP4gopro_50fps "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
            IF "%MP4gopro%"=="1" IF "%gopro25fps%"=="1" IF "%goproProgressive%"=="1" Set "MP4Gopro25fps=1" 
            IF "%MP4Gopro25fps%"=="1" (CALL :MP4gopro_25fps "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
            IF "%MP4gopro%"=="1" IF NOT "%gopro50fps%"=="1" IF NOT "%MP4Gopro25fps%"=="1" (CALL :MP4gopro_process "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            
            rem *** check FOR Generic Progressive or Interlaced
    
            Set "ScanTypeProgressive=0"
            Set "ScanTypeInterlaced=0"
    
            findstr /c:"Scan type                                : Progressive" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ScanTypeProgressive=1")
            findstr /c:"Scan type                                : Interlaced" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "ScanTypeInterlaced=1")      
    
            rem *** check if is an .avi mjpeg input file
            Set "TokenS=0"
            Set "isAVI=0"
            IF "%~x1"==".AVI" Set "TokenS=1" 
            IF "%~x1"==".avi" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isAVI=1"
            Set "TokenS=0"
            IF "%isAVI%"=="1" (v:\automazioneclip\virtualdub\mediainfo.exe "%CD%\%~n1.avi" dumpinfo:unicodefile.txt
            TYPE unicodefile.txt>mediainfo.txt)
            findstr /c:"Codec ID                                 : MJPG" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "AVImjpeg=1")
            if "%AVImjpeg%"=="1" (CALL :Make_File_AVImjpeg "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%UNCOMPRESSED%"=="1" (CALL :Make_File_AVImjpeg "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
            IF NOT "%ScanTypeProgressive%"=="1" IF NOT "%ScanTypeInterlaced%"=="1" Set "ScanTypeProgressive=1"
            IF "%scanMBAFF%"=="1" set "ScanTypeInterlaced=1"
            IF "%scanMBAFF%"=="1" Set "ScanTypeProgressive=0"
    
            rem *** redirect to generic PROGRESSIVE procedure
            IF "%ScanTypeProgressive%"=="1" if not "%scanMBAFF%"=="1" if not "%AVImjpeg%"=="1" if not "%UNCOMPRESSED%"=="1" IF NOT "%MP4gopro%"=="1" IF NOT "%MP4Gopro50fps%"=="1" IF NOT "%MP4Gopro25fps%"=="1" if not "%MXFXDCAM35or25_50fps_Progressive%"=="1" if not "%MXFXDCAMHQorSP25fpsProgressive%"=="1" if not "%fullHDinterlace%"=="1" if not "%fullHDProgressive%"=="1"  if not "%mxfHD422progressiveDoubleFrameRate%"=="1" if not "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" if not "%IMX%"=="1" if not "%dvcamPAL%"=="1" (CALL :Make_File_generic_PROGRESSIVE "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            
            rem *** redirect to generic NON-PROGRESSIVE procedure (interlaced mbaaf ..)
            IF NOT "%ScanTypeProgressive%"=="1" if not "%AVImjpeg%"=="1" IF NOT "%MP4gopro%"=="1" if not "%UNCOMPRESSED%"=="1" IF NOT "%MP4Gopro50fps%"=="1" if not "%MXFXDCAM35or25_50fps_Progressive%"=="1" if not "%MXFXDCAMHQorSP25fpsProgressive%"=="1" if not "%fullHDinterlace%"=="1" if not "%fullHDProgressive%"=="1"  if not "%mxfHD422progressiveDoubleFrameRate%"=="1" if not "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" if not "%IMX%"=="1" if not "%dvcamPAL%"=="1" (CALL :Make_File_generic_INTERLACED "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
            Set "ScanTypeProgressive=0"
    
            IF exist "%DestFolder%\unicodefile.txt" DEL "%DestFolder%\unicodefile.txt"
            IF exist  "%DestFolder%\mediainfo.txt" DEL "%DestFolder%\mediainfo.txt"
    	echo  FATTO
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :Process_Item <item_field> <item_data>
    color
    
    	if "%~2"=="N/A" goto :eof
    	if "%~1"=="[/STREAM]" (
    		set "CType="
    		goto :eof
    	)
    	if "%~1"=="[/FORMAT]" (
    		set "CType="
    		goto :eof
    	)
    	if "%~1"=="[FORMAT]" (
    		set "CType=FORMAT"
    		goto :eof
    	)
    	if "%~1"=="index" Set "cur_index=%~2"
    	if "%~1"=="codec_name" Set "cur_codec=%~2"
    	if "%~1"=="codec_type" (
    		if "%~2"=="audio" (
    			set /a AUCount+=1
    			set "CType=audio"
    		)
    		if "%~2"=="video" if NOT "%cur_codec%"=="mjpeg" (
    			Set /a VDCount+=1
    			set "CType=video"
    		)
    		if "%~2"=="subtitle" (
    			Set /a STCount+=1
    			set "CType=subtitle"
    		)
    		goto :eof
    	)
    	if "%CType%"=="FORMAT" (
    		if "%~1"=="TAG:company_name" set "T_Company_Name=%~2"
    		if "%~1"=="TAG:product_name" set "T_Product_Name=%~2"
    		if "%~1"=="TAG:product_version" set "T_Product_Version=%~2"
    		if "%~1"=="TAG:timecode" set "TIMECODE=%~2"
    		goto :eof
    	)
    	if "%CType%"=="video" (
    		if %VDCount% GTR 1 (
    			echo Multiple Video Streams!!!!
    			pause
    		)
    		if "%~1"=="time_base" set "V_Time_Base=%~2"
    		if "%~1"=="r_frame_rate" set "V_Frame_Rate=%~2"
    		if "%~1"=="duration_ts" set "V_Duration=%~2"
    		if "%~1"=="width" set "V_Width=%~2"
    		if "%~1"=="height" set "V_Height=%~2"
    		if "%~1"=="sample_aspect_ratio" set "V_PAR=%~2"
    		if "%~1"=="nb_frames" set "V_Number_Of_Frames=%~2"
    		goto :eof
    	)
    		
    goto :eof
    
    :Make_File_HD2HDinterlace <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    pfm unmount "%~n1_HDavs.avs"
    
    cls
    echo *** procedura da MXF fullHD 4:2:2 25fps interlacciato a file Avisynth .AVS HD 1920 x 1080  ***
    echo *** l'eventuale filtro di resize da applicare può essere solo IResize e non LanczosResize  ***
    
         
             v:\automazioneclip\core\ffmpeg.exe  -n -i %4 -filter_complex "[0:1] [0:2] amerge,volume=%AudioVolume%" -c:a pcm_s16le "%DestFolder%\%~n1_HDavs.wav"
             rem v:\automazioneclip\core\ffmpeg.exe  -n -i %4 -filter_complex "[0:3] [0:4] amerge,volume=%AudioVolume%" -c:a pcm_s16le "%DestFolder%\%~n1_HDch3ch4avs.wav"
    
            rem ***Make The .avs Script File ***
            echo Import^("v:\automazioneclip\avisynth\plugins\IResize.avsi"^)>"%~n1_HDavs.avs"
            echo SetMemoryMax^(%SetMemoryMaxValue%^)>>"%~n1_HDavs.avs"
            echo LoadPlugin^("v:\automazioneclip\avisynth\plugins\LSMASHSource.dll"^)>>"%~n1_HDavs.avs"
            echo LWLibavVideoSource^(%4^)>>"%~n1_HDavs.avs"
            echo #colorMatrix^(mode="Rec.601->Rec.709"^)>>"%~n1_HDavs.avs"
            echo #ColorYUV^(levels="PC->TV"^)>>"%~n1_HDavs.avs"
            echo #ColorYUV^(gamma_y=-7, gamma_u=-7, gamma_v=-7^)>>"%~n1_HDavs.avs"     
            echo AssumeFPS^(25^)>>"%~n1_HDavs.avs"
    
            echo bob^(^).SelectEven^(^)>>"%~n1_HDavs.avs"
    
            echo #usa_1_Make_File_HD2HDinterlace>>"%~n1_HDavs.avs"
           
           del *.ffindex
           del "%~dp1%~n1_blank.wav"
           del "%~dp1%~n1_blank.avs"
           rem del "%~n1_HDavs.avs"
    
           
           pfm mount "%~n1_HDavs.avs"
    
              for /f delims^=^" %%a in ('pfm flush "%~dp1%~n1_HDavs.avs"') do set "flushed1=%%a"
              set "flushed=%flushed1%\%~n1_HDavs.avi"
              del "%~dp1%~n1_HDavs.avi"
              v:\automazioneclip\core\mklink.exe /s "%~dp1%~n1_HDavs.avi" "%flushed%"
      
     goto :eof
    
    :GetTargetName
    color
    
    	Set "FileName="
    	Set /p FileName=InputFileName .mxf .mp4 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
    color
    
    	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
    Quote Quote  
  2. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    removing these lines should do it:

    goto :eof
    if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    )

    but the other way is to use "for /r"
    http://ss64.com/nt/for_r.html

    And in case you missed the reference (which I'm guessing you did) you can check error level as such:

    if %ERRORLEVEL%==1 (

    and skip the "level" bit.
    http://ss64.com/nt/errorlevel.html
    Quote Quote  
  3. THanks!! it works

    Click image for larger version

Name:	Im-a-DJ.gif
Views:	213
Size:	807.7 KB
ID:	34710
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!