How to encode timestamp into each frame of a RTSP stream

Michael MacIntosh mmacintosh at linear-systems.com
Wed Dec 11 21:57:27 UTC 2019


It would help to know what you are trying to accomplish by embedding a 
custom time code.  Because there may be a workaround that you are not 
aware of.  For instance to synchronize several players, you can use a 
gstreamer network clock.

You have to remember that RTSP is a standard protocol, and that 
gstreamer is going to convert what you are trying to do to play nice 
with other players that might not be gstreamer on the client end.

One way that I can think of is to use a data stream that is getting sent 
with the video stream as well, so you would have a video stream + (maybe 
audio) + a data stream, so you would have 3 channels.  This way you 
could use all of the facilities between gstreamer and RTSP to keep those 
data frames in-sync (roughly). To accomplish this, I would use an appsrc 
in your rtsp server. Granted I have never tried this before, so your 
mileage may vary.

You also might run into issues with #3 if you are encoding your frames, 
as the encoder might destroy or distort that information.

On 12/11/2019 5:03 AM, k4ustav wrote:
> Hi,
>
> I am streaming video using RTSP. Here I have access to both server and
> client. Now I want to encode timestamp to each frame so that I can access
> the timestamp from the client pipeline.
>
> Right now I have tried the following options,
>
> 1. Set PTS of each frame manually at the server. But on the client, PTS
> absolute value is not preserved. So, this doesn't work.
> 2. I tried to access GstBuffer metadata and write inside it. But GstBuffer
> metadata is not preserved beyond the server. Because of this, the client is
> not able to access the metadata.
> 3. Access each frame buffer and replace first pixel content with the
> timestamp. I can read the first pixel data on the client and get to know the
> timestamp. Although it works, it's not an ideal solution.
>
> Please help me to find a way to encode/embed the timestamp into the frame at
> the server so that I can retrieve it from the client pipeline.
>
> Thanks.
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list