[Libav-user] Syncing multiple sources.

Hristo Ivanov hivanov.ffmailing at gmail.com
Wed Jan 30 20:09:34 EET 2019


Hi

I forgot to speak about the timebases in use, and those are important in
this case.

For my two inputs, after decoding, my AVCodecContexts have the following
framerates and timebases:
in0 => 30/1, 1/60
in1 => 359/12, 6/359      // Well this is not exactly 30fps, but close.
The common selected timebase by the framesync filter is 1/21540.

Here are some of the ptss feeded to the filter:

in0: pts in original tb: 16(1/60), pts in tb used by framesync: 5744
in0: pts in original tb: 18(1/60), pts in tb used by framesync: 6462
in0: pts in original tb: 20(1/60), pts in tb used by framesync: 7180
in0: pts in original tb: 22(1/60), pts in tb used by framesync: 7898
in0: pts in original tb: 24(1/60), pts in tb used by framesync: 8616

in1: pts in original tb: 17(6/359), pts in tb used by framesync: 6120
in1: pts in original tb: 19(6/359), pts in tb used by framesync: 6840
in1: pts in original tb: 21(6/359), pts in tb used by framesync: 7560
in1: pts in original tb: 23(6/359), pts in tb used by framesync: 8280
in1: pts in original tb: 25(6/359), pts in tb used by framesync: 9000

The ptss of the two inputs are interleaved and that is why the vstack
filter triggers twice.

Another possible solution to my problem would be to force the timebases to
1/framerate, this would prevent the interleaving of the frames, something
like this:
"
 [in0]format=pix_fmts=yuv420p,scale=-1:540,settb=expr=1/30[s0];
 [in1]format=pix_fmts=yuv420p,scale=-1:540,settb=expr=1/30[s1];
 [s0][s1]vstack[stacked];
 [stacked]pad=1920:1080:(ow-iw)/2:0[out0]
"

Would this work? Is there a better, more general approach of solving this
problem.

For inputs with different framerates my plan is to select the greatest and
use that, something like this:
"
 [in0]format=pix_fmts=yuv420p,scale=-1:540,settb=expr=1/greatestFps,fps=fps=
greatestFps[s0];
 [in1]format=pix_fmts=yuv420p,scale=-1:540,settb=expr=1/greatestFps,fps=fps=
greatestFps[s1];
 [s0][s1]vstack[stacked];
 [stacked]pad=1920:1080:(ow-iw)/2:0[out0]
"

Thanks.

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


More information about the Libav-user mailing list