Gapless audio switching with input-selector

Sebastian Dröge sebastian at
Sat Nov 14 09:57:35 UTC 2020

On Thu, 2020-11-12 at 08:27 -0600, Lusine wrote:
> Hi Folks,
> I have 2 audio streams and want to output mix of these audios in the
> following way:
> 2 seconds from first stream(from 0-2 sec), then 2 sec from 2nd stream(from 2
> to 4 secs of the 2nd audio), then again 2 sec from first stream and so on.
> For this reason I use input-selector and identity element. Input selector is
> connected to identity. In identity's handoff callback I'm calculating audio
> samples and if desired number of audio is processed I switch
> input-selector's input. But after switching I get this error message:
> qtmux gstqtmux.c:4535:gst_qt_mux_add_buffer: decreasing DTS value
> 0:00:02.090645833 < 0:00:02.111979166
> Why I get this message? Maybe input-selector is not a good choice for this
> purpose? How I can achieve my desired result?

Not entirely sure why this error happens exactly in your case, but
input-selector can't provide gapless switching between streams

Your best choice for that would currently be audiomixer, I guess. You
could have all but one stream muted, and then do switching from a
buffer probe on the source pad of it or from the new `samples-selected` signal.
That way you can also implement cross-fading on switching, which will
generally provide a nicer user experience.

Sebastian Dröge, Centricular Ltd ·

More information about the gstreamer-devel mailing list