Hi, but please be patient: I'm a cat
if possible I would like do a batch that return the total number of frames of a video source
How to do it?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
Code:
for /F "tokens=1,2 delims=^=" %%g in ('ffprobe64bit333.exe -hide_banner -loglevel fatal -pretty -show_streams -select_streams v:0 "INPUT.MXF" 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 "%number_of_frames%"
I get the number_of_frames as %number_of_frames%
but now I need to do a operation:
if this number of frames is less than 7 set ......
if not set ......
ho to do it? -
Do a reverse franistan comparison with the gonkulator.
Scott -
leq=!=====
echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
echo ³ ³
echo ³ DEBUG ROUTINE 6 ³
echo ³ ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
set "sourceForNumberFramesCount="
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullHD%"=="1" set "sourceForNumberFramesCount=%DestFolder%/%~n1_reg6a_%panState%HD_FFMBCencoder_xPDWF800.mxf"
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullSD%"=="1" set "sourceForNumberFramesCount=%DestFolder%/%~n1_reg6b%panState%_FFMBC_IMX.mxf"
IF "%AltriCodec_NON_UncompressedYUY2%"=="1" set "sourceForNumberFramesCount=%~dp1%~n1%panState%HD_ Totalcode_reg6c_xPDWF800.mxf"
echo sourceForNumberFramesCount assume %sourceForNumberFramesCount%
for /F "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\core\ffprobe64bit333.exe -hide_banner -loglevel fatal -pretty -show_streams -select_streams v:0 "%sourceForNumberFramesCount%" 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 "%number_of_frames%"
set "number_of_frames_inferioreOugualea5=0"
if %number_of_frames% LEQ 5 set "number_of_frames_inferioreOugualea5=1"
IF "%number_of_frames_inferioreOugualea5%"=="1" echo numero di frames totali inferiori a 5
IF NOT "%number_of_frames_inferioreOugualea5%"=="1" echo numero di frames totali superiori a 5
if exist "%~dp1debugFileName.txt" del "%~dp1debugFileName.txt"
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullHD%"=="1" echo %~n1_Routine6_reg6a_%panState%HD_FFMBCencoder_xPDW F800_debug_%date:/=%_%time:~0,2%_%time:~3,2%_%TIME:~9,2%>debugFileNa me.txt
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullSD%"=="1" echo %~n1_Routine6_reg6b%panState%_FFMBC_IMX_debug_%dat e:/=%_%time:~0,2%_%time:~3,2%_%TIME:~9,2%>debugFileNa me.txt
IF "%AltriCodec_NON_UncompressedYUY2%"=="1" echo %~n1_Routine6_%panState%HD_Totalcode_reg6c_xPDWF80 0_debug_%date:/=%_%time:~0,2%_%time:~3,2%_%TIME:~9,2%>debugFileNa me.txt
set /p debugFileName=<debugFileName.txt
if exist "z:\\temp11\\%debugFileName%.avi" "del z:\\temp11\\%debugFileName%.avi"
if exist "z:\\temp11\\%debugFileName%.wav" "del z:\\temp11\\%debugFileName%.wav"
rem ***Make The .avs Script File***
IF EXIST "%~dpn1_Debug.avs" del "%~dpn1_Debug.avs"
echo Import^("v:\automazioneclip\avisynth\plugins\IResize.avsi"^)>"%~dpn1_Debug.avs"
echo LoadPlugin^("v:\automazioneclip\avisynth\plugins\L SMASHSource.dll"^)>>"%~dpn1_Debug.avs"
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullHD%"=="1" echo LWLibavVideoSource^("%DestFolder%/%~n1_reg6a_%panState%HD_FFMBCencoder_xPDWF800.mxf" ^)>>"%~dpn1_Debug.avs"
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullSD%"=="1" echo LWLibavVideoSource^("%DestFolder%/%~n1_reg6b%panState%_FFMBC_IMX.mxf"^)>>"%~dpn1_Deb ug.avs"
IF "%AltriCodec_NON_UncompressedYUY2%"=="1" echo LWLibavVideoSource^("%~dp1%~n1%panState%HD_Totalco de_reg6c_xPDWF800.mxf"^)>>"%~dpn1_Debug.avs"
IF "%FullHD%"=="1" echo colorMatrix^(mode="Rec.709->Rec.601"^)>>"%~dpn1_Debug.avs"
IF "%FullSD%"=="1" echo crop^(0,32,0,0^)>>"%~dpn1_Debug.avs"
set "eventualeCM709to601="
set "eventualeCrop32necessario="
IF "%FullHD%"=="1" set "eventualeCM709to601=-vf colormatrix=bt709:bt601"
IF "%FullSD%"=="1" set "eventualeCrop32necessario=-vf crop=720:576:0:32"
if exist tempInferiore5frames.MKV del tempInferiore5frames.MKV
IF "%number_of_frames_inferioreOugualea5%"=="1" V:\automazioneclip\core\ffmpeg64bit2014.exe -y -i "%sourceForNumberFramesCount%" %eventualeCM709to601% %eventualeCrop32necessario% -vcodec rawvideo -pix_fmt yuv422p -r 25 -an tempInferiore5frames.MKV
rem ***Make The .vcf Script File***
IF EXIST "%~dpn1_Debug.vcf" del "%~dpn1_Debug.vcf"
echo VirtualDub.audio.SetSource^(0^)^;>"%~dpn1_Debug.vcf"
echo VirtualDub.audio.SetMode^(0^)^;>>"%~dpn1_Debug.vcf "
echo VirtualDub.audio.SetInterleave^(1,500,1,0,0^)^;>>" %~dpn1_Debug.vcf"
echo VirtualDub.audio.SetClipMode^(1,1^)^;>>"%~dpn1_Deb ug.vcf"
echo VirtualDub.audio.SetEditMode^(1^)^;>>"%~dpn1_Debug .vcf"
echo VirtualDub.audio.SetConversion^(0,0,0,0,0^)^;>>"%~ dpn1_Debug.vcf"
echo VirtualDub.audio.SetVolume^(^)^;>>"%~dpn1_Debug.vc f"
echo VirtualDub.audio.SetCompression^(^)^;>>"%~dpn1_Deb ug.vcf"
echo VirtualDub.audio.EnableFilterGraph^(0^)^;>>"%~dpn1 _Debug.vcf"
echo VirtualDub.video.SetInputFormat^(0^)^;>>"%~dpn1_De bug.vcf"
echo VirtualDub.video.SetOutputFormat^(11^)^;>>"%~dpn1_ Debug.vcf"
IF "%FullHD%"=="1" echo VirtualDub.video.SetMode^(3^);>>"%~dpn1_Debug.vcf"
IF "%FullSD%"=="1" echo VirtualDub.video.SetMode^(1^)^;>>"%~dpn1_Debug.vcf "
echo VirtualDub.video.SetSmartRendering^(0^)^;>>"%~dpn1 _Debug.vcf"
echo VirtualDub.video.SetPreserveEmptyFrames^(0^)^;>>"% ~dpn1_Debug.vcf"
echo VirtualDub.video.SetFrameRate2^(0,0,1^)^;>>"%~dpn1 _Debug.vcf"
echo VirtualDub.video.SetIVTC^(0, 0, 0, 0^)^;>>"%~dpn1_Debug.vcf"
echo VirtualDub.video.SetCompression^(0x6a6d7674,0,1000 0,0^);>>"%~dpn1_Debug.vcf"
echo VirtualDub.video.SetCompData^(28,"TUpQRxgAAAAAAAAA AgAAAAgAAAACAAAAAQAAAA=="^);>>"%~dpn1_Debug.vcf"
echo VirtualDub.video.filters.Clear^(^);>>"%~dpn1_Debug .vcf"
echo VirtualDub.video.filters.Add^("deinterlace"^);>>"% ~dpn1_Debug.vcf"
echo VirtualDub.video.filters.instance[0].Config^(0,1,1^);>>"%~dpn1_Debug.vcf"
echo VirtualDub.video.filters.Add^("resize"^);>>"%~dpn1 _Debug.vcf"
echo VirtualDub.video.filters.instance[1].Config^(720,576,0,4,3,0,320,240,4,3,0,135,1,0x000 000^);>>"%~dpn1_Debug.vcf"
echo VirtualDub.video.filters.Add^("interlace"^);>>"%~d pn1_Debug.vcf"
echo VirtualDub.video.filters.instance[2].Config^(0, 0^);>>"%~dpn1_Debug.vcf"
echo VirtualDub.audio.filters.Clear^(^);>>"%~dpn1_Debug .vcf"
echo VirtualDub.SaveAVI^("z:\\temp11\\%debugFileName%.a vi"^);>>"%~dpn1_Debug.vcf"
echo VirtualDub.Close^(^);>>"%~dpn1_Debug.vcf"
IF NOT "%number_of_frames_inferioreOugualea5%"=="1" v:\automazioneclip\VirtualDub\VirtualDub.exe /min "%~n1_Debug.avs" /s "%~dpn1_Debug.vcf" /x
IF "%number_of_frames_inferioreOugualea5%"=="1" v:\automazioneclip\VirtualDub\VirtualDub.exe /min "tempInferiore5frames.MKV" /s "%~dpn1_Debug.vcf" /x
if exist tempInferiore5frames.MKV del tempInferiore5frames.MKV
rem #### check duration of avigen file ########################
if exist aviGenDuration.txt del aviGenDuration.txt
Set "aviGenDuration=undef"
v:\automazioneclip\core\FFProbe64bit2014.exe -loglevel fatal -show_entries format=duration -of csv="p=0" -sexagesimal "z:\\temp11\\%debugFileName%.avi">aviGenDuration.t xt
set /p aviGenDuration=<aviGenDuration.txt
if exist aviGenDuration.txt del aviGenDuration.txt
echo durata pari a %aviGenDuration%
rem #### check duration of avigen file ########################
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullHD%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -i "%DestFolder%/%~n1_reg6a_%panState%HD_FFMBCencoder_xPDWF800.mxf" -filter_complex "[0:1] [0:2] amerge" -vn "z:\\temp11\\%debugFileName%.wav"
IF NOT "%usaTotalcodeAnzicheFFBCperCodificareInMXF_linear eRoutine6_SorgenteYUY2uncompressed%"=="1" IF "%UNCOMPRESSED_YUY2%"=="1" IF "%FullSD%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -i "%DestFolder%/%~n1_reg6b%panState%_FFMBC_IMX.mxf" -af "pan=stereo:c0=c0:c1=c1,apad" -shortest -t %aviGenDuration% -vn "z:\\temp11\\%debugFileName%.wav"
IF "%FullSD%"=="1" if "%AltriCodec_NON_UncompressedYUY2%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -i "%~dp1%~n1%panState%HD_Totalcode_reg6c_xPDWF800.mx f" -map_channel 0.1.0 -map_channel 0.1.1 -vn "z:\\temp11\\%debugFileName%.wav"
IF "%FullHD%"=="1" if "%AltriCodec_NON_UncompressedYUY2%"=="1" v:\automazioneclip\core\ffmpeg.exe -y -i "%~dp1%~n1%panState%HD_Totalcode_reg6c_xPDWF800.mx f" -filter_complex "[0:1] [0:2] amerge" -vn "z:\\temp11\\%debugFileName%.wav"
if exist "%~dp1debugFileName.txt" del "%~dp1debugFileName.txt"
IF EXIST "%~dpn1_Debug.avs" del "%~dpn1_Debug.avs"
IF EXIST "%~dpn1_Debug.vcf" del "%~dpn1_Debug.vcf"
Set "aviGenDuration=undef"
DEL "%DestFolder%\*.ffindex"
seems solved thanks
Similar Threads
-
How to get the number of frames of a video file with ffprobe?
By marcorocchini in forum Newbie / General discussionsReplies: 36Last Post: 12th May 2019, 05:06 -
batch to return the last item in a .txt file
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 8th Sep 2017, 17:53 -
Number of frames in d2v files
By ZikO in forum Video ConversionReplies: 5Last Post: 10th Apr 2017, 12:24 -
Finding individual "bad" frames in video and save frame number, or repair
By johnmeyer in forum RestorationReplies: 6Last Post: 13th Dec 2016, 20:59 -
Return of the Jedi dropped and duplicated frames.
By Xyphox in forum Blu-ray RippingReplies: 10Last Post: 30th Dec 2014, 00:42