How to mix live and non-live sources

Marianna Smidth Buschle msb at qtec.com
Fri Sep 24 11:17:19 UTC 2021


On 24.09.2021 13.05, Sebastian Dröge wrote:
> On Fri, 2021-09-24 at 12:59 +0200, Marianna Smidth Buschle via 
> gstreamer-devel wrote:
>> I have a use case where I have N live sources (v4l2src) from which I can
>> select to be the output.
>>
>> I also need to be able to make a replay (seek from a filesrc).
>>
>> My question is how to properly handle the mixing of the live and
>> non-live sources since the timestamps don't match.
>>
>> The filesrc starts from zero (or the seeking point) and the live sources
>> have a running-time based on the clock.
>
> This is actually simpler than what you wrote. What you would do is to 
> call gst_pad_set_offset() on the source pad of the non-live streams 
> that you want to connect to the mixer.
> That would then make sure to update the running time accordingly.

Can I do that directly on the filesrc (the MPEG-TS) stream?

Or should it be on the tsdemux pads, or later on the audio/video decoder 
pads?

>
> The offset would in the simplest case be the current running time when 
> connecting the non-live stream.
> You can get that from the current pipeline clock's time minus the 
> current pipeline's base time.
>
> Alternatively you might want to add some more time to that to schedule 
> the non-live stream into the future, or do more complicated 
> calculations to schedule the start of the stream to a specific time.
>
>
> Note that after a (flushing) seek the running time starts again at 0, 
> so you might need to re-offset here after a seek.
>
> -- 
> Sebastian Dröge, Centricular Ltd · https://www.centricular.com 
> <http://www.centricular.com>
>
-- 
Best regards / Med venlig hilsen
“Marianna Smidth Buschle”

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210924/c5fbcb9b/attachment-0001.htm>


More information about the gstreamer-devel mailing list