VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 37
Thread
  1. answer for cats only thanks
    Quote Quote  
  2. please I have to modify, in the batch, this line

    Code:
    FFProbe -hide_banner -loglevel fatal -pretty -show_streams -count_frames -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'
    so that ffprobe recognize the number of frames of a video file
    Quote Quote  
  3. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    nb_frames

    -Edit- Hopefully number of frames is easy to determine in an mxf or you might as well just let FFVideoSource index the thing.
    Quote Quote  
  4. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    The cat nonsense is getting REAL old REAL fast.
    Quote Quote  
  5. Originally Posted by ndjamena View Post
    nb_frames

    -Edit- Hopefully number of frames is easy to determine in an mxf or you might as well just let FFVideoSource index the thing.
    sorry but nb_frames seems I cannot recognize

    try to modify your kind script, at maximun I find that:
    Code:
    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
    	) 
    
    
     for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdubmod\FFProbe -hide_banner -loglevel fatal -pretty -select_streams v:0 -show_streams "%~1" 2^>^null') DO (
    		 if "%%~g"=="duration_ts" set "NumberOfFrame=%%~h")
    
    
    echo the variabile NumberOfFrame assume this value "%NumberOfFrame%"
    but possibly I would integrate the second line into the first block,

    and the ^null' is wrong

    or if it's another way.. please let me know: help a cat, thanks
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    You could download MediaInfoCLI and its companion MediaInfo.DLL and run it first to get the frames :

    "C:\Users\Bud\Desktop\MediaInfo.exe" "--Inform=Video;%FrameCount%" "C:\<PathToVideo>\Beautiful Romantic Spanish Guitar Music.mp4"

    To which you will receive the reply and could assign to a variable? like:
    7102
    Last edited by Budman1; 2nd Oct 2014 at 12:04. Reason: Corrected Script " placements
    Quote Quote  
  7. @ffprobe -threads %NUMBER_OF_PROCESSORS%*1.5 -v quiet -pretty -print_format csv -select_streams v:0 -count_frames -show_entries "stream=nb_frames,nb_read_frames" %1 > %1.csv
    Quote Quote  
  8. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    ffprobe -select_streams v:0 -show_entries "stream=nb_frames" %1
    pause

    Put that in a .bat and drop one of your .mxf files on it, if what you get in return is 'nb_frames=N/A' then you really, really might as well just let FFMSIndex index the files rather then even try to get a frame count from FFProbe. (Then you can get the frame count via a few lines in an AviSynth script.)
    Quote Quote  
  9. Possibly I would like including the frame count in the main line:
    Code:
    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')
    of the batch script

    but I try to understand: ffprobe mistake the frame count and ffmsindex is right?
    Quote Quote  
  10. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    The line Pandy gave you, you don't want, the line I gave you has nothing to do with your script, it's to find out how available the frame count is to FFProbe.

    We need to know more before we can get to a final conclusion as to what you should be doing.

    Do exactly this and don't post anything more in this thread until you do:

    1: put this:
    ffprobe -select_streams v:0 -show_entries "stream=nb_frames" %1
    pause
    in a .bat file, all by itself.

    2: drag and drop one of your mxf files onto the .bat file

    3: find the line that starts with "nb_frames=" and tell us what is written after the "=" sign.
    Last edited by ndjamena; 1st Oct 2014 at 07:13.
    Quote Quote  
  11. it's this

    Click image for larger version

Name:	FN.jpg
Views:	2247
Size:	247.3 KB
ID:	27785
    Quote Quote  
  12. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    nb_frames=N/A

    FFProbe DOES NOT KNOW how many frames there are in your file, and it won't be able to figure it out without going through the entire file and counting them. You may have a bit more luck with your MP4s, it depends on what was written into the headers by whichever software muxed them, but for the mxf files at least you have no way of knowing how many frames are in the files without indexing them.

    (I'm assuming DirectShowSource and VirtualDub just guess how many frames there are.)
    Quote Quote  
  13. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    On marcorocchini's note, the following script head start will give you what you want for FrameCount, just need to do it each time.
    This calls MediaInfo CLI and inserts it back into your script/batch:

    mediainfo.exe "--Inform=Video;%%FrameCount%%" C:\Users\Bud\Desktop\C0020_2.mxf > tmpfile
    set /p nb_frames = < tmpFile
    del tmpFile
    set nb_frames

    "c:\Users\bud\desktop\FFProbe.exe" -select_streams v:0 -show_entries "stream=nb_Frames" C:\Users\Bud\Desktop\C0020_2.mxf
    set nb_frames


    YIELDS:
    Click image for larger version

Name:	ScreenHunter_106 Oct. 02 01.53.jpg
Views:	499
Size:	209.3 KB
ID:	27805
    Quote Quote  
  14. useful and interesting thanks , but at this point ffprobe is not necessary and is enough the only mediainfo, or not?
    Quote Quote  
  15. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    If a value isn't readily available MediaInfo will take whatever information it has and make it's best guess as to what that value ought to be. That value will be quite accurate enough in the vast majority of cases, but anyone who's used MediaInfo long enough will know that it gets things wrong occasionally too.

    FFProbe has the right idea in not showing values that it doesn't know to be 100% accurate, and using MediaInfo would most likely be no more accurate than making the calculations manually based on the Duration_TS and time_base fields in ffprobe (Although possibly a tad easier).

    (I thought I was getting Duration_TS values from MKVs before I went out, now I'm not anymore... why is that?)
    Quote Quote  
  16. sorry I have a lot of confusion in my head of cat and I can not understand anything
    to stay on the safe side - for the moment - this script "count" "frames number" (or something that) only in .mxf file: this seems don't mistake. And let to the "generic" routine of avisynth all the rest (that, however process correctly only 25 or 50 fps)

    FFProbe acts on all files input and drag&dropped
    Code:
    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 (
    but only .mxf files (and only the .mxf 50 fps) are filtered to have been processed by virtualdub, using mediainfo

    Code:
    v:\automazioneclip\virtualdub\mediainfo.exe "%CD%\%~n1.mxf" dumpinfo:unicodefile.txt
            TYPE unicodefile.txt>mediainfo.txt
            findstr /c:"Codec ID                                 : 0D01030102020201-0401020202010200" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set
    But for .mp4 files I have noted that this procedure cannot work because this frames count is wrong, when I have more time to devote to this thing I try to solve the problem if I can. if someone finds a better solution I thank him ^^



    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off
    
    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 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
    	
    	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 <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\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%"
    
    	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!
    		)
    	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%
     
            v:\automazioneclip\virtualdub\mediainfo.exe "%CD%\%~n1.mxf" 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")
               
            set "fullHDinterlace=0" 
            set "xdcamhd422=unknown"
            set "fps=unknown"
            set "ch_sub=unknown"
            set "scanInterlace=unknown"
            findstr /c:"Commercial name                          : XDCAM HD422" "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")
            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 50" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "IMX=1")
    
            set "MXFXDCAMHQorSP25fpsinterlaced=0"
            set "MXFXDCAMHQorSP25fpsProgressive=0"  
            set "fps25=unknown"
            set "ch_sub420=unknown"
            findstr /c:"Commercial name                          : XDCAM HD 35" "mediainfo.txt"
            IF NOT ERRORLEVEL 1 (set "xdcamhd35=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:"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")
            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 "%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"
    
    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_HD2SDinterlace "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
            if "%fullHDProgressive%"=="1" (CALL :Make_File_HD2SDProgressive "%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 "%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 "%dvcam%"=="1" (CALL :Make_File_dvcam "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")  
    
            if not "%MXFXDCAMHQorSP25fpsProgressive%"=="1" if not "%fullHDProgressive%"=="1"  if not "%mxfHD422progressiveDoubleFrameRate%"=="1" if not "%dvcam%"=="1" if not "%MXFXDCAMHQorSP25fpsinterlaced%"=="1" if not "%IMX%"=="1" if not "%fullHDinterlace%"=="1"  CALL :Make_File_generic "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1"
    
    	echo  FATTO
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :Make_File_HD2SDinterlace <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** procedura da MXF HD 1920x1080 4:2:2 25fps interlacciato a SD (morgan mjpeg) AVI usando solo virtualdub per velocizzare ***
    pause
    
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1_SD.wav"
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1ch3ch4_SD.wav"
            
             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^(0^);>>%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^("alias format"^);>>%1
             echo VirtualDub.video.filters.instance[0].Config^(2, 0^);>>%1
             echo VirtualDub.video.filters.Add^("deinterlace"^);>>%1
             echo VirtualDub.video.filters.instance[1].Config^(0,1,1^);>>%1
             echo VirtualDub.video.filters.Add^("resize"^);>>%1
             echo VirtualDub.video.filters.instance[2].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1
             echo VirtualDub.video.filters.Add^("interlace"^);>>%1
             echo VirtualDub.video.filters.instance[3].Config^(0, 0^);>>%1
             echo VirtualDub.video.filters.Add^("convert format"^);>>%1
             echo VirtualDub.video.filters.instance[4].Config^(32^);>>%1
             echo VirtualDub.audio.filters.Clear^(^);>>%1
     if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
     if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	 echo VirtualDub.Close^(^);>>%1
    
     %VD_LOC% /min %4 /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%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
    
           
     goto :eof
    
    
    :Make_File_HD2SDprogressive <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** procedura da MXF HD 1920x1080 4:2:2 25fps progressivo da ridurre a SD (morgan mjpeg) AVI usando solo virtualdub per velocizzare ***
    pause
    
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1_SD.wav"
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1ch3ch4_SD.wav"
            
             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^(0^);>>%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^("alias format"^);>>%1
             echo VirtualDub.video.filters.instance[0].Config^(2, 0^);>>%1
             echo VirtualDub.video.filters.Add^("resize"^);>>%1
             echo VirtualDub.video.filters.instance[1].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1
             echo VirtualDub.video.filters.Add^("convert format"^);>>%1
             echo VirtualDub.video.filters.instance[2].Config^(32^);>>%1
             echo VirtualDub.audio.filters.Clear^(^);>>%1
     if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
     if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	 echo VirtualDub.Close^(^);>>%1
    
     %VD_LOC% /min %4 /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%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
    
           
     goto :eof
    
    :Make_File_mxfHD422progressivemode50fps <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** procedura Make_File_mxfHD422progressivemode50fps da MXF HD 4:2:2 50fpsPROGRESSIVO qualsiasi risoluzione HD tranne fullHD da ridurre a SD (morgan mjpeg) AVI usando solo virtualdub per velocizzare ***
    pause
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1_SD.wav"
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1ch3ch4_SD.wav"
            
             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^(0^);>>%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^("alias format"^);>>%1
             echo VirtualDub.video.filters.instance[0].Config^(2, 0^);>>%1
             echo VirtualDub.video.filters.Add^("resize"^);>>%1
             echo VirtualDub.video.filters.instance[1].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1
             echo VirtualDub.video.filters.Add^("interlace"^);>>%1
             echo VirtualDub.video.filters.instance[2].Config^(0, 0^);>>%1
             echo VirtualDub.video.filters.Add^("convert format"^);>>%1
             echo VirtualDub.video.filters.instance[3].Config^(32^);>>%1
             echo VirtualDub.audio.filters.Clear^(^);>>%1
             if "%doubleframrate%"=="1" echo VirtualDub.subset.Clear^(^);>>%1
             if "%doubleframrate%"=="1" echo VirtualDub.subset.AddRange^(0,%forVirtualDubAddRangeWhenDoubleFrameRate%^);>>%1
             if "%doubleframrate%"=="1" echo VirtualDub.video.SetRange^(^);>>%1
             if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
             if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	 echo VirtualDub.Close^(^);>>%1
    
     %VD_LOC% /min %4 /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
           rem DEL "%DestFolder%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
           
     goto :eof
    
    :Make_File_MXFXDCAMHQorSP25fpsinterlaced <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** procedura da MXF HD varie risoluzioni XDCAM HQ o SP o xdcam F335 4:2:0 25fps interlaced a SD (morgan mjpeg) AVI usando solo virtualdub per velocizzare ***
    pause
    
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1_SD.wav"
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1ch3ch4_SD.wav"
            
             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^(0^);>>%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^("Auto YUY2 v1.2.0"^);>>%1
             echo VirtualDub.video.filters.instance[0].Config^(0, 1, 4^);>>%1
             echo VirtualDub.video.filters.Add^("alias format"^);>>%1
             echo VirtualDub.video.filters.instance[1].Config^(2, 0^);>>%1
             echo VirtualDub.video.filters.Add^("deinterlace"^);>>%1
             echo VirtualDub.video.filters.instance[2].Config^(0,1,1^);>>%1
             echo VirtualDub.video.filters.Add^("resize"^);>>%1
             echo VirtualDub.video.filters.instance[3].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1
             echo VirtualDub.video.filters.Add^("interlace"^);>>%1
             echo VirtualDub.video.filters.instance[4].Config^(0, 0^);>>%1
             echo VirtualDub.video.filters.Add^("convert format"^);>>%1
             echo VirtualDub.video.filters.instance[5].Config^(32^);>>%1
             echo VirtualDub.audio.filters.Clear^(^);>>%1
             if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
             if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	 echo VirtualDub.Close^(^);>>%1
    
     %VD_LOC% /min %4 /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%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
    
           
     goto :eof
    
    :Make_File_MXFXDCAMHQorSP25fpsProgressive <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** procedura da MXF HD varie risoluzioni XDCAM HQ o SP o xdcam F335 4:2:0 25fps progressive a SD (morgan mjpeg) AVI usando solo virtualdub per velocizzare ***
    pause
    
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1_SD.wav"
             v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1ch3ch4_SD.wav"
            
             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^(0^);>>%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^("Auto YUY2 v1.2.0"^);>>%1
             echo VirtualDub.video.filters.instance[0].Config^(0, 0, 4^);>>%1
             echo VirtualDub.video.filters.Add^("alias format"^);>>%1
             echo VirtualDub.video.filters.instance[1].Config^(2, 0^);>>%1
             echo VirtualDub.video.filters.Add^("resize"^);>>%1
             echo VirtualDub.video.filters.instance[2].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1
             echo VirtualDub.video.filters.Add^("convert format"^);>>%1
             echo VirtualDub.video.filters.instance[3].Config^(32^);>>%1
             echo VirtualDub.audio.filters.Clear^(^);>>%1
             if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
             if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	 echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	 echo VirtualDub.Close^(^);>>%1
    
     %VD_LOC% /min %4 /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%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
    
           
     goto :eof
    
    :Make_File_IMX <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** procedura da MXF IMX a morgan mjpeg AVI usando solo virtualdub per velocizzare ***
    pause
    
    
            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_SD.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_SD.wav"
    
    	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^(0^)^;>>%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
            if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^)^;>>%1
            if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^)^;>>%1
    	echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^)^;>>%1
    	echo VirtualDub.Close^(^)^;>>%1
    
            %VD_LOC% /min %4 /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%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
           
    goto :eof
    
    :Make_File_dvcam <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
            echo *** procedura DVCAM versus SD AVI (Morgan) solo virtualdub per velocizzare ***
            echo  Frame_Rate = %Frame_Rate%
    pause
    
            v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:1] [0:2] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1_SD.wav"
            v:\automazioneclip\core\ffmpeg.exe  -y -i %4 -filter_complex "[0:3] [0:4] amerge,volume=1.5" -c:a pcm_s16le "%DestFolder%\%~n1ch3ch4_SD.wav"
    
    
            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^(0^)^;>>%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^("Auto YUY2 v1.2.0"^);>>%1
            echo VirtualDub.video.filters.instance[0].Config^(0, 1, 4^);>>%1
            echo VirtualDub.video.filters.Add^("field delay"^);>>%1
            echo VirtualDub.video.filters.instance[1].Config^(0^);>>%1
            echo VirtualDub.video.filters.Add^("convert format"^);>>%1
            echo VirtualDub.video.filters.instance[2].Config^(11^);>>%1
            echo VirtualDub.audio.filters.Clear^(^);>>%1
            if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
            if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	echo VirtualDub.Close^(^);>>%1
    
            %VD_LOC% /min %4 /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%\*.VCF"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
          
    goto :eof
    
    
    :Make_File_generic <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo inizio routine generic
    pause
            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_SD.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_SD.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_SD.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_SD.wav")) 
    
            rem *** TRY extract audio from .MXF DVCAM ***
            Set "TokenS=0"
            IF "%~x4"==".MXF" Set "TokenS=1" 
            IF "%~x4"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" (if "%dvcam%"=="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_SD.wav"))
            If "%TokenS%"=="1" (if "%dvcam%"=="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_SD.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_SD.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_SD.wav")
                            
            echo *** from various format to MorganMJPEG AVI SD 720x576i@25fps using Avisynth+Virtualdub ***
         	
            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^(0^);>>%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.video.filters.Add^("deinterlace"^);>>%1
            echo VirtualDub.video.filters.instance[0].Config^(0,1,1^);>>%1
            echo VirtualDub.video.filters.Add^("resize"^);>>%1
            echo VirtualDub.video.filters.instance[1].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000000^);>>%1
            echo VirtualDub.video.filters.Add^("interlace"^);>>%1
            echo VirtualDub.video.filters.instance[2].Config^(0, 0^);>>%1
            echo VirtualDub.audio.filters.Clear^(^);>>%1        
            echo VirtualDub.audio.filters.Clear^(^);>>%1
            if NOT "%TimeCode%"=="" echo VirtualDub.project.ClearTextInfo^(^);>>%1
            if NOT "%TimeCode%"=="" echo VirtualDub.project.AddTextInfo^("ISMP", "%TIMECODE%"^);>>%1
    	echo VirtualDub.SaveAVI^("%DestFolder%\\%~n1_SD.avi"^);>>%1
    	echo VirtualDub.Close^(^);>>%1
    
    
     rem ***Make The .avs Script File***
          
            echo Import("C:\Program Files\AviSynth\plugins\IResize.avsi")>%2
            echo FFVideoSource^(%4^)>>%2
            echo ConvertToYUY2^(interlaced=true^)>>%2
            if "%dvcam%"=="1" echo ReverseFieldDominance^(^)>>%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==1920 ^&^& src.height==1088 ? src.crop^(0,0,1920,1080^): src >>%2
            echo src = src.width^>720 ^|^| src.height^>608?src.ColorMatrix^(mode="Rec.709->Rec.601"^): src >>%2
            echo src.width!=720 ^|^| src.height!=576 ? src.IResize^(720,576^): src >>%2
            if "%Frame_Rate%" == "50/1" echo AssumeTFF^(^).SeparateFields^(^).SelectEvery^(4,0,3^).Weave^(^) >>%2
            echo AssumeFPS^(25^)>>%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"
           rem DEL "%DestFolder%\*.avs"
           DEL "%DestFolder%\unicodefile.txt"
           DEL "%DestFolder%\mediainfo.txt"
          
           v:\automazioneclip\virtualdub\cfourcc.exe -i "%CD%\%~n1_SD.avi" -u MJPG -d MJPG
          
           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
    Quote Quote  
  17. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    It not the frame count, it's the duration according to the time_base. It's just co-incidence that it happens to be the same number as the frame count with some of your files and only happens when the time_base is identical to the frame rate.
    Quote Quote  
  18. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    r_frame_rate=25/1
    avg_frame_rate=25/1
    time_base=1/25000
    start_pts=2000
    start_time=0:00:00.080000
    duration_ts=151000000
    duration=1:40:40.000000
    bit_rate=930.481000 Kbit/s
    nb_frames=151000
    This is one of my mp4s. According to the information mp4box put in the file there are 151000 frames in the video and the frame rate is 25fps. Duration_ts is 151000000, which is 1000 times more than the number of frames. The time base is 1/25000, which is 1000 times smaller than the frame rate of 1/25. Comprendie?

    That method of identifying the frame count will only work on video streams with a constant frame rate.
    Quote Quote  
  19. Code:
    :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\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")
       
            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"=="nb_frames" set "nb_framesValue=%%~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%" quindi meta uguale a echo "%forVirtualDubAddRangeWhenDoubleFrameRate%"
            echo nb_frames "%nb_framesValue%"
    
    pause
    Try it to my GOPR1234.mp4:

    it seems work weel (but it's strange! in a previous proof I read in virtualdub 811 frames and now opening the same .mp4 virtualdub show 909 ?!?)

    Click image for larger version

Name:	VD99.jpg
Views:	627
Size:	347.6 KB
ID:	27807


    but also I try with a different types of mp4
    Quote Quote  
  20. Originally Posted by ndjamena View Post

    That method of identifying the frame count will only work on video streams with a constant frame rate.
    -______-

    Name:  bbcat.gif
Views: 8603
Size:  1.53 MB
    Quote Quote  
  21. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Code:
    @echo off
    for /F "tokens=1,2 delims=^=" %%g in ('ffprobe -hide_banner -loglevel fatal -pretty -show_streams -select_streams 
    
    v:0 "%~f1" 2^>^&1') do (
    	if "%%~g"=="time_base" set "time_base=%%~h"
    	if "%%~g"=="r_frame_rate" set "frame_rate=%%~h"
    	if "%%~g"=="duration_ts" set "duration_ts=%%~h"
    )
    for /F "tokens=1,2 delims=/" %%g in ("%time_base%") do (
         set "time_base_denom=%%~g"
         set /a "time_base_num=%%~h*10000"
    )
    for /F "tokens=1,2 delims=/" %%g in ("%frame_rate%") do (
         set /a "frame_rate_num=%%~g*10000"
         set "frame_rate_denom=%%~h"
    )
    echo %duration_ts% / ((%time_base_num%/%time_base_denom%)/(%frame_rate_num%/%frame_rate_denom%))
    
    Set /a "number_of_frames=duration_ts/((time_base_num/time_base_denom)/(frame_rate_num/frame_rate_denom))"
    
    echo %number_of_frames%
    
    pause
    Thar we go.
    Last edited by ndjamena; 2nd Oct 2014 at 09:36.
    Quote Quote  
  22. I get an error of division by zero

    edit1: ah no sorry, I missed the complete path of ffprobe, but with this

    Code:
    :Process_File <FILENAME>
    cls
    	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\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 -show_streams -select_streams v:0 "%~f1" 2^>^&1') do (
    	if "%%~g"=="time_base" set "time_base=%%~h"
    	if "%%~g"=="r_frame_rate" set "frame_rate=%%~h"
    	if "%%~g"=="duration_ts" set "duration_ts=%%~h"
            )
            for /F "tokens=1,2 delims=/" %%g in ("%time_base%") do (
            set "time_base_denom=%%~g"
            set /a "time_base_num=%%~h*10000"
            )
            for /F "tokens=1,2 delims=/" %%g in ("%frame_rate%") do (
            set /a "frame_rate_num=%%~g*10000"
            set "frame_rate_denom=%%~h"
            )
            echo %duration_ts% / ((%time_base_num%/%time_base_denom%)/(%frame_rate_num%/%frame_rate_denom%))
            Set /a "number_of_frames=duration_ts/((time_base_num/time_base_denom)/(frame_rate_num/frame_rate_denom))"
           
    
    set "number_of_frames=FPSforVirtualdub"
    
            echo "%FPSforVirtualdub%"
    
    pause
    seems that FPSforVirtualdub is not defined
    Last edited by marcorocchini; 2nd Oct 2014 at 10:03.
    Quote Quote  
  23. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    That's because you never define it, you're just deleting number_of_frames.
    Quote Quote  
  24. Code:
    for /F "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -select_streams v:0 "%~f1" 2^>^&1') do (
    	if "%%~g"=="time_base" set "time_base=%%~h"
    	if "%%~g"=="r_frame_rate" set "frame_rate=%%~h"
    	if "%%~g"=="duration_ts" set "duration_ts=%%~h"
            )
            for /F "tokens=1,2 delims=/" %%g in ("%time_base%") do (
            set "time_base_denom=%%~g"
            set /a "time_base_num=%%~h*10000"
            )
            for /F "tokens=1,2 delims=/" %%g in ("%frame_rate%") do (
            set /a "frame_rate_num=%%~g*10000"
            set "frame_rate_denom=%%~h"
            )
            echo %duration_ts% / ((%time_base_num%/%time_base_denom%)/(%frame_rate_num%/%frame_rate_denom%))
            Set /a "number_of_frames=duration_ts/((time_base_num/time_base_denom)/(frame_rate_num/frame_rate_denom))"
     
            echo "%number_of_frames%"
    
    pause
    
    .....
            if "%doubleframrate%"=="1" echo VirtualDub.subset.AddRange^(0,%number_of_frames%^);>>%1
    Click image for larger version

Name:	anigif_enhanced-buzz-8114-1323304351-1.gif
Views:	2095
Size:	486.2 KB
ID:	27811

    it does work! thanks
    Quote Quote  
  25. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Try this:

    Code:
    :Process_File <FILENAME>
    cls
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    	SetLocal DisableDelayedExpansion
    	set "Audio=v:\automazioneclip\system\empty.wav"
    	if exist "%~dpn1.wav" set "Audio=%~dpn1.wav"
    
    	rem #### Find TimeCode Info ####
    	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 "%~f1" 2^>^&1') DO (
    		if "%%~g"=="[/STREAM]" set "CType="
    		if "%%~g"=="[FORMAT]" set "CType=FORMAT"
    		if "%%~g"=="codec_type" (
    			if "%%~h"=="audio" set /a AUCount+=1
    			if "%%~h"=="video" Set /a VDCount+=1
    			if "%%~h"=="subtitle" Set /a STCount+=1
    			set "CType=%%~h"
    		)
    		if "%CType%"=="FORMAT" (
    			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 "%CType%=="video" (
    			if VDCount GTR 1 (
    				echo Multiple Video Streams!!!!
    				pause
    			)
    			if "%%~g"=="time_base" set "V_Time_Base=%%~h"
    			if "%%~g"=="r_frame_rate" set "V_Frame_Rate=%%~h"
    			if "%%~g"=="duration_ts" set "V_Duration=%%~h"
    			if "%%~g"=="r_frame_rate" set "V_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"=="nb_frames" if NOT "%%~h"=="N/A" set "V_Number_Of_Frames=%%~h"
    		)
    	) 
    
    	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"
    	)
    	for /F "tokens=1,2 delims=/" %%g in ("%V_Frame_Rate%") do (
    		set /a "V_Frame_Rate_Num=%%~g*10000"
    		set "V_Frame_Rate_Denom=%%~h"
    	)
    	echo %V_Duration% / ((%V_Time_Base_Num%/%V_Time_Base_Denom%)/(%V_Frame_Rate_Num%/%V_Frame_Rate_Denom%))
    	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 "FPSforVirtualdub=V_Number_Of_Frames%"
    
    	echo "%FPSforVirtualdub%"
    
    pause
    Quote Quote  
  26. I get no error apparently and the batch exit automatically, I try to understand but I think mine don't work because there are something wrong in this part
    Code:
    	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
    	) pause
    Quote Quote  
  27. Code:
    :Process_File <FILENAME>
    
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    	SetLocal DisableDelayedExpansion
    	set "Audio=v:\automazioneclip\system\empty.wav"
    	if exist "%~dpn1.wav" set "Audio=%~dpn1.wav"
    
    	rem #### Find TimeCode Info ####
    	Set AUCount=0;
    	Set VDCount=0;
    	Set STCount=0;
    	set "V_Number_Of_Frames="
    pause 
    	for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -show_format -show_streams "%~f1" 2^>^&1') pause DO (
    		if "%%~g"=="[/STREAM]" set "CType="
    		if "%%~g"=="[FORMAT]" set "CType=FORMAT"
    		if "%%~g"=="codec_type" (
    			if "%%~h"=="audio" set /a AUCount+=1
    			if "%%~h"=="video" Set /a VDCount+=1
    			if "%%~h"=="subtitle" Set /a STCount+=1
    			set "CType=%%~h"
    		)
    		if "%CType%"=="FORMAT" (
    			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 "%CType%=="video" (
    			if VDCount GTR 1 (
    				echo Multiple Video Streams!!!!
    				pause
    			)
    			if "%%~g"=="time_base" set "V_Time_Base=%%~h"
    			if "%%~g"=="r_frame_rate" set "V_Frame_Rate=%%~h"
    			if "%%~g"=="duration_ts" set "V_Duration=%%~h"
    			if "%%~g"=="r_frame_rate" set "V_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"=="nb_frames" if NOT "%%~h"=="N/A" set "V_Number_Of_Frames=%%~h"
    		)
    	) 
    
    	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"
    	)
    	for /F "tokens=1,2 delims=/" %%g in ("%V_Frame_Rate%") do (
    		set /a "V_Frame_Rate_Num=%%~g*10000"
    		set "V_Frame_Rate_Denom=%%~h"
    	)
    	echo %V_Duration% / ((%V_Time_Base_Num%/%V_Time_Base_Denom%)/(%V_Frame_Rate_Num%/%V_Frame_Rate_Denom%))
    	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 "FPSforVirtualdub=V_Number_Of_Frames%"
    
    	echo "%FPSforVirtualdub%"
    it arrive at the first "pause" --> so until here is "ok"

    but it don't arrive at the second "pause": is there a problem processing the line

    Code:
    for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdub\FFProbe -hide_banner -loglevel fatal -pretty -show_format -show_streams "%~f1" 2^>^&1')
    ?
    Quote Quote  
  28. "v:\automazioneclip\virtualdub\FFProbe" shouldn't there be a .exe at the end on Windows?
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  29. Code:
    -show_streams "%~f1" 2^>^&1')
    ?
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!