How to get timestamp in UTC or system time for a frame in gstreamer pipeline?

Viewed 53

I'm using uridecodebin to capture live streams, and I feed frames into appsink. I need to record timestamp for a received frame either in UTC or system time. So far I managed to receive PTS timestamp:

guint64 timestamp = GST_BUFFER_TIMESTAMP(buffer) 

from which I can get running time and stream time:

guint64 pos = gst_segment_to_stream_time(segment, GST_FORMAT_TIME, timestamp);
guint64 run_time = gst_segment_to_running_time(segment, GST_FORMAT_TIME, timestamp)

For first frame pos is always 0, but run_time is around 7008 ms. Why is that? I dont understand where that time is coming from.

And for main part of the question, how do I get timestamp that can relate appsink frame as close as possible to the actual time frame was captured in system time or UTC?

0 Answers
Related