[FFmpeg-user] Help with complex filter chain?

Moritz Barsnick barsnick at gmx.net
Thu Nov 26 11:44:33 CET 2015


On Thu, Nov 26, 2015 at 09:42:12 +0100, Paul B Mahol wrote:

> ffmpeg -loop 1 -i Background.png -i a.webm -i b.webm -filter_complex "[1:v]scale=320:240[left];[2:v]scale=320:240[right];[left][right]hstack[out],[v:0][out]overlay=0:57:shortest=1[video];[1:a][2:a]amerge=inputs=2[audio]" -map "[audio]" -map "[video]" blah.webm

There's a typo in there:
"[v:0]" -> "[0:v]"

A more verbose comment to the original:

> >   ffmpeg -i Background.png -i a.webm -i b.webm -loop 1 -filter_complex
> > "[0:v]overlay=0:57:shortest=1[c];[1:v]scale=320:240[left];[2:v]scale=320:240[right];[1:a][2:a]amerge=inputs=2[a];[left][right]hstack[out]"
> > -map [out] -map "[c]" -map "[a]" blah.webm

Did you notice that you, Mike, have three "-map" arguments? This
results in two(!) video streams and one audio stream:

> >    hstack -> Stream #0:0 (libvpx-vp9)
> >    overlay -> Stream #0:1 (libvpx-vp9)
> >    amerge -> Stream #0:2 (libopus)

It very much depends on the player whether you get to see both (and
whether you notice that both exist).

Furthermore, you broke the whole concept of a "filter *chain*" by
putting the overlay at the beginning, and not mapping both intenden
parts to its inputs. ;-)

Apart from that, I believe Paul's command line outlines the concept
pretty nicely: Scale your two videos (each), hstack them next to each
other, and overlay that onto the image.

Moritz


More information about the ffmpeg-user mailing list