[Live-devel] RTP presentation times

DJM-Avalesta david.myers at avalesta.com
Thu Jul 29 01:57:33 PDT 2021


Hi,

My video encoder/server takes a PAL TV input, h.264 encodes it, and 
streams it out on an  RTP multicast stream to a decoder.

I am finding that the decoder output is somewhat erratic and not 
decoding smoothly when compared to the original input to the encoder. 
The decoder (3rd party) is blaming the RTP presentation times it is 
receiving in the encoded stream.

I am simply using gettimeofday() for every frame  eg.

      g_ettimeofday(&fPresentationTime, NULL);_

Other encoders and IP cameras seem to have perfectly sequenced 
presentation times so, for a 25fps stream, each frame has a presentation 
time of exactly 40ms later than the previous frame, whereas my stream 
varies from 27ms to 42ms or worse.

I could replace gettimeofday with something like this, but is this 
valid?

   if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0)
     gettimeofday(&fPresentationTime, NULL);
   else
       {
     // Increment by the sample time
     unsigned uSeconds = fPresentationTime.tv_usec + 1000000/25; //25fps, 
the frame rate
     fPresentationTime.tv_sec += uSeconds/1000000;
     fPresentationTime.tv_usec = uSeconds%1000000;
   }

Also, other encoders seem to have the same timestamp for the SPS and PPS 
frames as for the corresponding video frames, whereas my encoder has 
individual timestamps on the SPS and PPS packets, which are different 
from the video frames timestamps.

Do I need to add logic to give SPS and PPS frames the same timestamp as 
the corresponding video frames?

Many thanks
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20210729/338d968d/attachment.htm>


More information about the live-devel mailing list