Constructing GstRTPBuffer to get RTP packet timestamp

Nirbheek Chauhan nirbheek.chauhan at gmail.com
Wed Nov 24 10:01:02 UTC 2021


On Tue, Nov 23, 2021 at 6:00 PM kalpesh shukla via gstreamer-devel
<gstreamer-devel at lists.freedesktop.org> wrote:
>
> Hi,
>
> In one of our python based video streaming applications we are required to get a timestamp of the RTP packet for synchronization purposes.

What sort of synchronization do you want to do? GStreamer has built-in
mechanisms for the common use-cases.

> While going through the GStreamer documents we came across GstRTPBuffer (which is part of RTP library) helper functions which can be used to extract RTP timestamp and other RTP header related details.
> We are not able to find any reference on how to get GstRTPBuffer to start working on RTP header.
>
> Below is the example pipeline for reference,
>
> gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/livestream ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink
>

You can add a pad probe on the sinkpad of the depayloader:

https://gstreamer.freedesktop.org/documentation/gstreamer/gstpad.html?gi-language=c#gst_pad_add_probe
https://gstreamer.freedesktop.org/documentation/additional/design/probes.html?gi-language=c#overview

and map the GstBuffer as a GstRTPBuffer:

https://gstreamer.freedesktop.org/documentation/rtplib/gstrtpbuffer.html?gi-language=c#gst_rtp_buffer_map

That will give you access to all this.

Cheers,
Nirbheek


More information about the gstreamer-devel mailing list