涉及循环嵌套,启用变量延时,算术运算
@echo off setlocal enabledelayedexpansion %路径以及文件名等变量设置% set x264_exe=E:\demo\c++\x264\vs2008_build\bin\x264.exe set encode_basic_option=--fps 20 --profile baseline --tune zerolatency --min-keyint 20 --keyint 30 --no-scenecut set input_path=E:\video\yuv_640x480\ set output_path=E:\video\x264\ 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:\demo\c++\x264\vs2008_build\bin\x264.exe set encode_basic_option=--fps 20 --profile baseline --tune zerolatency --min-keyint 20 --keyint 30 --no-scenecut set input_path=E:\video\yuv_640x480\ set output_path=E:\video\x264\ 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