[Libav-user] Syncing multiple sources.

Hristo Ivanov hivanov.ffmailing at gmail.com
Wed Jan 30 17:41:35 EET 2019


In my program I have the following filter:

My problem comes from the 'vstack' filter. The stack filters assign the
same synclevel to all of their inputs, libavfilter/vf_stack.c around line
    for (i = 0; i < s->nb_inputs; i++) {
        AVFilterLink *inlink = ctx->inputs[i];

        in[i].time_base = inlink->time_base;
        in[i].sync   = 1;  // This line here is the important.
        in[i].before = EXT_STOP;
        in[i].after  = s->shortest ? EXT_STOP : EXT_INFINITY;

    return ff_framesync_configure(&s->fs);

With the same synclevel on all the inputs, the framesync filter activates
on all the inputs, which has the following undesired effect:
   Being bought of the inputs(in0, in1) at 30fps, the output(out0) is at

The easy fix for this, was to use the fps filter and have something like

The problem I have with this solution is that stacking frames at 2xFps just
to discard half of them seems wasteful to me, cpu and memory wise.

Having the following filter:
 [ stacked ]pad=1920:1080:(ow-iw)/2:0[out0]
where the framesync of the vstack filter only triggers on one of the inputs
seems to me a better solution.

Is there a way to achieve this? Can the synclevels be set by the users?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190130/4454ce97/attachment.html>

More information about the Libav-user mailing list