yazanpro
yazanpro

Reputation: 4762

FFmpeg pass arguments in a text file

I'm trying to get around the 32767 characters limit regarding the command line length in Windows (sometimes it's less than that). I have a large number of boxes that I'm trying to draw on a video. Typically I can concatenate the draw commands using a comma (,) like so (the following command draws two boxes):

ffmpeg -i input.mp4 -vf "drawbox=enable='between(t, 1.5, 4)' : x=100 : y=100 : w=200 : h=200 : color=green,drawbox=enable='between(t, 9, 18)' : x=500 : y=10 : w=150 : h=150 : color=red" -codec:a copy output.mp4

However since I have many boxes to draw, the length of the entire command becomes too large.

Does FFmpeg offer a way to pass all arguments in a text file instead of literal text? Something like this:

ffmpeg content(ffmpegCmd.txt)

If that's not possible, is it possible to "buffer" the arguments into separate commands while exporting the result only in the last command?

Upvotes: 2

Views: 5131

Answers (2)

Ivan Balaban
Ivan Balaban

Reputation: 11

-filter_complex_script filename doesn't work. For example:

ffmpeg -i 1.mkv -codec copy 1.mp4

works fine.

Next I place -codec copy to filters.txt and try

ffmpeg -i 1.mkv -filter_complex_script filters.txt 1.mp4

It gives me the error: No such filter -codec copy

Upvotes: 1

llogan
llogan

Reputation: 134083

Does FFmpeg offer a way to pass all arguments in a text file instead of literal text?

Use the -filter_complex_script option. From the documentation:

-filter_complex_script filename (global)

This option is similar to -filter_complex, the only difference is that its argument is the name of the file from which a complex filtergraph description is to be read.

Basic example:

ffmpeg -i input -filter_complex_script filters.txt output

Upvotes: 5

Related Questions