[FFmpeg-user] Resolving -filter_complex overlay / -vf yadif conflicts in subprocess call Python script
Moritz Barsnick
barsnick at gmx.net
Wed Sep 11 15:00:38 EEST 2019
Hi Joanna,
On Wed, Sep 11, 2019 at 12:18:57 +0100, digitensions via ffmpeg-user wrote:
> Thanks for admitting me to FFmpeg-user, and thanks to all those who
> maintain this list. The information I’ve been receiving since joining
> is outstanding.
Thanks, welcome here.
> ffmpeg -i input_file -i watermark.png -filter_complex overlay -c:v libx263 -pix_fmt yuv420p -vf yadif -metadata copyright=“blah” -metadata comment=“contact blah” -c:a aaa -report output_file
What's the intent? To first do an overlay, then to deinterlace? You
need to specify your intent correctly (to yourself and use ;-)) first,
before designing your command (and for helping us assist you with it).
Assuming your watermark.png isn't interlaced, you probably want to
deinterlace the input_file first, then overlay a watermark, correct?
> For reference, the script is here: https://github.com/digitensions/MACEscripts/blob/master/main.py
Probably not necessary, you actually provided all the relevant
information. ("Media Archive for Central England" sounds important.
;-))
> Filtergraph 'yadif' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph.
> -vf/-af/-filter and -filter_complex cannot be used together for the same stream.
This message is pretty clear. You need to use one or the other, and
combine your filters to so-called chains. There's some explanation
here:
https://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1
but probably even better in ffmpeg's wiki.
Anyway, I suggest the following:
$ ffmpeg -i input_file -i watermark.png -filter_complex "[0:v]yadif[deint]; [deint][1:v]overlay[out]" -map "[out]" -map 0:a [...]
(untested)
Note how the input can be named, as well as the outputs of each chain.
My syntax here is two separate "chains" (with only one filter each),
which are assembled with "[]" inputs and outputs, and separated by ";".
Within each filter chain, you can connect one filter's output with the
next filter's input with a ",", e.g.
-filter_complex "[0:v]yadif,scale=w=iw/2:h=-2[out]"
or
-vf "yadif,scale=w=iw/2:h=-2"
(Just as a syntax example, not for your use case.)
> combining yadif with the -filter_complex and had no success
It's often helpful to also point out what else you tried and what the
result was (and what you were expecting), but my hints should help you
forward.
> The alternative is to write an if statement that checks for
> interlacing and activates the yadif call separately, which I’m happy
> to attempt if needed.
That's a different topic, deinterlacing conditionally.
Cheers,
Moritz
More information about the ffmpeg-user
mailing list