I am trying to add a watermark to a video using ffmpeg-python
. My pipeline is very straightforward, but I've been unable to figure out the syntax:
new_input = ffmpeg.input(file_name).filter('overlay', 'overlay.png').output(fout).run()
This throws the error Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_overlay_7
, likely because the syntax for the overlay filter is incorrect.
Since overlay filter requires two inputs, the syntax is a bit confusing.
There are good example here.
Here is a code sample:
import ffmpeg
file_name = 'input.mp4'
fout = 'output.mp4'
(
ffmpeg
.filter([ffmpeg.input(file_name), ffmpeg.input('overlay.png')], 'overlay', 10, 10)
.output(fout)
.run()
)