<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi,</p>
<p>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.</p>
<p>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.</p>
<p>I am simply using gettimeofday() for every frame eg.</p>
<p> g<em>ettimeofday(&fPresentationTime, NULL);</em></p>
<div id="signature">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.</div>
<div> </div>
<div>I could replace gettimeofday with something like this, but is this valid?</div>
<div>
<pre> 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;
}
</pre>
</div>
<div>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.</div>
<div> </div>
<div>Do I need to add logic to give SPS and PPS frames the same timestamp as the corresponding video frames?</div>
<div> </div>
<div>Many thanks</div>
<div>David</div>
</body></html>