我会使用
for
,推我的列表。txt进入
对于
通过标准输入循环(带有
<
),然后让
set /p
逐行捕获(每个循环迭代一次)。比如:
@echo off & setlocal
(
for %%I in (*.mp3) do (
rem // set /P grabs one line of input from stdin
set /P "imagefile="
setlocal enabledelayedexpansion
if defined imagefile call :build "%%~I" "!imagefile!" "%%~dpnI.mp4"
endlocal
set "imagefile="
)
) < mylist.txt
rem // The line above dumps mylist.txt into stdin, letting set /P grab one line at a time.
goto :EOF
:build <in_mp3> <in_image> <outfile>
C:\VideoConverter\Applications\ffmpeg.exe -f image2 -loop 1 -framerate 0.1 ^
-i "%~1" -i "%~2" -codec:v libx264 -s 1920x1080 -acodec copy -strict experimental ^
-movflags faststart -t 00:10:10.00 -f mp4 "%~3"