0

I have e.g. file 1.mp4, 2.mp4, 3.mp4 etc. that needs converting

for %i in (*.mp4) do ffmpeg -y -i "%i" -vf scale=1280:720 -crf 17 -c:v libx265 "%~ni.mp4"

Then I concatenate

ffmpeg -f concat -safe 0 -i xmylist.txt -crf 17 -c copy x1.mp4

Now, I wanna do this in one step and failed with

for %i in (*.mp4) do ffmpeg -y -i "%i" -vf scale=1280:720 -crf 17 -c:v libx265, -f concat -safe 0 -i xmylist.txt -crf 17 -c copy "%~ni.mp4"

How to fuse these two together properly? The error I got was

Option vf (set video filters) cannot be applied to input url xmylist.txt -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for input file xmylist.txt. Error opening input files: Invalid argument

1

Have you tried:

for %i in (*.mp4) do ffmpeg -y -i "%i" -vf scale=1280:720 -crf 17 -c:v libx265 "%~ni.mp4" & ffmpeg -f concat -safe 0 -i xmylist.txt -crf 17 -c copy "%~ni.mp4"

or this in a batch:

for %%i in (*.mp4) DO (

ffmpeg -y -i "%%i" -vf scale=1280:720 -crf 17 -c:v libx265 "%%~ni.mp4"

ffmpeg -f concat -safe 0 -i xmylist.txt -crf 17 -c copy "%%~ni.mp4"

)

although paying attention to what you are trying to do is it good to do it this way being you are concatenating the same file that is already a single file?

being you cannot use more than one set of () in a for loop here is a possible solution using 3 batch files:

You use start command because if you just put it in there it will run both batches and close instantly.

Batch 1:

start "Batch2.bat"

start "Batch3.bat"

Batch 2:

for %%i in (*.mp4) DO ffmpeg -y -i "%%i" -vf scale=1280:720 -crf 17 -c:v libx265 "%%~ni.mp4"

Batch 3:

for %%i in (*.mp4) DO ffmpeg -f concat -safe 0 -i xmylist.txt -crf 17 -c copy "x1.mp4"

Please let me know:). I can look into a much more advanced cmd at home later tonight to help you out with this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.