0

I am processing video with FFmpeg. I am trying to add image overlays at certain times. I have command something like this:

ffmpeg -i video.mp4 -i img_a.png -i img_xx.png -i some_third_image.png -i yy_img.png 
-filter_complex overlay=185:H-h-85:enable=between(t\\,0.1\\,0.3),overlay=285:H-h-415:enable=between(t\\,0.3\\,0.7),overlay=185:H-h-35:enable=between(t\\,0.7\\,1.0),overlay=45:H-h-515:enable=between(t\\,1.1\\,1.6) 
-c:v libx264 -crf 20 -preset veryfast vid0.mp4

As I am forming/passing parameters to FFmpeg dynamically (programmatically), there can be really very very long parameters list. So large, that I can even receive a message about too long parameter list (based on operating system).

I would like to avoid this. I would like to know how to write code with FFmpeg so there would be fewer parameters passed to FFmpeg? For example, instead of:

-i img_a.png -i img_xx.png -i some_third_image.png -i yy_img.png

can it be something like:

-i "img_a.png,img_xx.png,some_third_image.png,yy_img.png"

And if it can, how can those images be processed by FFmpeg (suppose also by filter_complex overlay)? Please provide an example, if you can.

  • You could try use -filter_complex_script option and pass parameters as txt file. – Paul B. Mahol Apr 19 at 11:48
1

You can not give fewer parameters, and expect the same functionality.

Instead make use of options -filter_script and -filter_complex_script. And write all parameters in script file.

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.