ffmpeg concat batch loop with text file

2019-09-06 13:40发布

I'm trying to batch a concat loop for a series of avi files where I need to add to each AVI a preroll and postroll movie.

Here's what I've tried:

_input.txt file:

file '3D_preroll.avi'
file '%%a'
file '3D_postroll.avi'

concat.bat file:

for %%a in ("*.avi") do ffmpeg -f concat -i _input.txt -c:v libx264 -b:v 1700k -minrate 1500k -maxrate 1900k -bufsize 1900k -deinterlace -acodec libvo_aacenc -ac 2 -ar 48000 -ab 92k "%%a"_432p.mp4
pause

Unfortunately, I get the following error message before FFMPEG crashes: Impossible to open '%%a'

What am I doing wrong?

Thank you :)

1条回答
看我几分像从前
2楼-- · 2019-09-06 14:14

This might work for you:

@ECHO OFF &SETLOCAL 
set "ConcatScript=_input.txt"
for %%a in (*.avi) do (
    (echo file '3D_preroll.avi'
    echo file '%%~a'
    echo file '3D_postroll.avi'
    )>"%ConcatScript%"
    ffmpeg -f concat -i "%ConcatScript%" -c:v libx264 -b:v 1700k -minrate 1500k -maxrate 1900k -bufsize 1900k -deinterlace -acodec libvo_aacenc -ac 2 -ar 48000 -ab 92k "%%~a_432p.mp4"
)
pause
查看更多
登录 后发表回答