Frame index from GST_BUFFER_PTS.
markcox80 at gmail.com
Tue Apr 4 05:57:43 UTC 2023
I am trying to write a GStreamer element, embedfoo, which embeds data
in received GStreamer video frame buffers using the function
gst_buffer_add_meta. The data added to the buffer is retrieved from a
database using the frame index of the GstBuffer.
I am using the value of GST_BUFFER_PTS and the framerate to obtain the
frame index of the received GstBuffers. The issue I am having is that
the value of the PTS timestamps in the received GstBuffer objects
differs according to the source.
For example, if I output the value of GST_BUFFER_PTS for the first
buffer received in the following pipelines I get differing results:
videotestsrc ! video/x-raw,framerate=15/1 ! embedfoo
location=database.txt ! x265enc ! mpegtsmux ! filesink location=test.ts
Pipeline 1 First PTS value:
filesrc location=test.ts ! decodebin ! embedfoo location=database.txt !
videoconvert ! ximagesink
Pipeline 2 First PTS value:
The embedfoo element is implemented as a subclass of GstBaseTransform
and I am using GStreamer 1.14.5 as provided by Ubuntu 18.04.
I have tried using the methods gst_segment_position_from* and
gst_segment_to_stream_time using the segment member of
GstBaseTransform, but I am unable to correctly calculate the frame
index of a buffer from the PTS timestamp.
Any pointers would be awesome.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gstreamer-devel