Gstreamer Tee Question about Synch

Nicolas Dufresne nicolas at
Fri Oct 8 16:16:57 UTC 2021

Adding back the mailing list in CC.

Le vendredi 08 octobre 2021 à 11:30 -0400, Dwight Kulkarni a écrit :
> Hi Nicolas,
> You had advised me previously on how to setup the Tee and use the appsink with
> new-sample callback to get hold of a Jpeg image. On the second tee I am using
> a splitmuxsink to save mp4 files.
> I am having a challenge where I need to correlate the time on my new-sample
> jpeg to the time on the splitmuxsink.
> For example, if I am recording a 30 second segment on splitmuxsink and I get a
> new-sample callback I need to know that this is at 11.2 seconds (for example)
> in the file being saved by the splitmuxsink.
> Would I use the gstreamer clock to do this ? If I just use the system clock
> I'm worried that they two files may not be in synch.

There is likely more then 1 solution to this. The way I have used in the past
was to format the file names according to the file start running-time (see
gst_segment_to_running_time(), which is a helper that convert the PTS using the
segment event provided GstSegment to a common timeline called "running time".
You can then pick any jpeg, do the same operation and as you know you file
duration you can walk the recording and find which recording contains that time.

A likely more standard way, would be to inject some TimeCode, but that I'm less
knowledgeable. I believe other folks are using that approach to interoperate
with standard Television backend appliance.


More information about the gstreamer-devel mailing list