Combining two ffmpeg fillters or commands into single command
I want to combine two ffmpeg commands to single ffmpeg command. I want to apply a vintage effect and a watermark on a video.
Please help me in creating a single ffmpeg command.
It's very simple. If you have a single filter working on one video stream:
ffmpeg -i input -filter:v "scale=-1:480" output
… and you want to add a second filter, then all you have to do is add it with a comma:
ffmpeg -i input -filter:v "scale=-1:480, fps=fps=30" output
This will generate a chain of filters. You don't need to specify input and output here, since it'll just take the input file's video stream.
If on the other hand you have a complex filtergraph (i.e. one that uses multiple chains and multiple inputs/outputs) you have to pipe the filterchain output to the next filterchain's input, separate the chains by a semicolon (;
), and then map the overall filter output to the output file:
ffmpeg -i input1 -i input2 -filter_complex "[0:v][1:v] overlay [ol]; \ [ol] scale=-1:480 [outv]" -map "[outv]" output
Of course, you can use as many chains and filters you want. Read the filtergraph documentation for more info. There are tons of examples on how to combine filters.