Timestamping frame buffers correctly

jonmccormack jonmccormack1999 at hotmail.co.uk
Sat Feb 8 22:23:17 UTC 2020


Hello all,
I've been trying to learn how to use Gstreamer for the past few weeks, using
the appsrc element in a c++ application stream video to an RTMP server.

I have raw frame data coming in from another part of my application, which
has the timestamp the frame was created in milliseconds since the unix
epoch.

Being a total beginner with regards to working with video streaming, it
looks like timestamping the frame buffers that are piped into the gstreamer
pipeline is essential, especially when creating a networks stream. It looks
like the buffers are timestamped in nanoseconds since the moment the
gstreamer pipeline was created.

I thought I would be able to save a record of when the pipeline was created,
then use the following formula to timestamp the frames appropriately:

(frame timestamp (ms) - pipeline start time (ms)) * 1000000

However, the avenc_flv element fails to encode the buffers as the pts
(presentation time stamp (I believe)) is invalid. The output suggests the
timestamp of the frame buffer is invalid (pts invalid (0) <= last (0)).

My pipeline is defined as follows:


And my function to pipe data into the pipeline is as follows:


Could anyone offer some advice for fixing my problem?

Thanks in advance 
Jon

P.S. I appriciate there may be some fine tuning required to improve
streaming performance etc, but I was hoping to get a basic RTMP stream
working first before I began tweaking. When outputting to the autovideosink
sink element, the stream works fine, though I do believe that is more
forgiving regards frame timestamps :)




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list