涉及循环嵌套,启用变量延时,算术运算
@echo off setlocal enabledelayedexpansion %路径以及文件名等变量设置% set x264_exe=E:democ++x264vs2008_buildinx264.exe set encode_basic_option=--fps 20 --profile baseline --tune zerolatency --min-keyint 20 --keyint 30 --no-scenecut set input_path=E:videoyuv_640x480 set output_path=E:videox264 set name_prefix=video_640x480 %同时设置VBV和CRF% for /l %%i in (1,1,2) do ( call :CRF ) goto :eofvbv :CRF for /l %%c in (17,2,19) do ( call :VBV ) goto :eofvbv :VBV for /l %%v in (100,100,200) do ( set bufsize=%%v set /a bufsize=!bufsize!+!bufsize!/2 echo %x264_exe% %encode_basic_option% --crf %%c --vbv-maxrate %%v --vbv-bufsize !bufsize! -o %output_path%%name_prefix%_%%i_crf%%c_vbv%%v.h264 %input_path%%name_prefix%_%%i.yuv ) :eofvbv
@echo off %路径以及文件名等变量设置% set x264_exe=E:democ++x264vs2008_buildinx264.exe set encode_basic_option=--fps 20 --profile baseline --tune zerolatency --min-keyint 20 --keyint 30 --no-scenecut set input_path=E:videoyuv_640x480 set output_path=E:videox264 set name_prefix=video_640x480 %不设置VBV% for /l %%i in (1,1,1) do call :CRF %%i goto :eofnovbv :CRF for /l %%c in (17,2,19) do ( echo %x264_exe% %encode_basic_option% --crf %%c -o %output_path%%name_prefix%_%%i_crf%%c_vbvno.h264 %input_path%%name_prefix%_%%i.yuv ) :eofnovbv