[Libav-user] Syncing multiple sources.
Hristo Ivanov
hivanov.ffmailing at gmail.com
Wed Jan 30 17:41:35 EET 2019
Hi.
In my program I have the following filter:
"
[in0]format=pix_fmts=yuv420p,scale=-1:540[s0];
[in1]format=pix_fmts=yuv420p,scale=-1:540[s1];
[s0][s1]vstack[stacked];
[stacked]pad=1920:1080:(ow-iw)/2:0[out0]
"
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
290:
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
~60fps.
The easy fix for this, was to use the fps filter and have something like
this:
"
[in0]format=pix_fmts=yuv420p,scale=-1:540[s0];
[in1]format=pix_fmts=yuv420p,scale=-1:540[s1];
[s0][s1]vstack[stacked];
[stacked]fps=fps=30[normalized];
[normalized]pad=1920:1080:(ow-iw)/2:0[out0]
"
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:
"
[in0]format=pix_fmts=yuv420p,scale=-1:540,fps=fps=30[s0];
[in1]format=pix_fmts=yuv420p,scale=-1:540,fps=fps=30[s1];
[s0][s1]vstack[stacked];
[ 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?
Thank.
-------------- 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