[FFmpeg-user] RTP/H264 Decoding - DTS is not set

Sergio Basurco sergio.b at coherentsynchro.com
Thu Sep 28 18:29:33 EEST 2017

Hi there,

(Context: RTSP H264 decoding for IP cameras)

After some reading I found in the RTP Payload format for H.264 that:

"The RTP timestamp is set to the sampling timestamp of the content. A 90 
kHz clock rate MUST be used."

 From which I assume that if a camera does not send timing info in the 
SPS; I must assume the RTP timestamps have a 90kHz timebase.

I set my codecCtx as such:

   pCodecCtx->time_base.num = 1;
   pCodecCtx->time_base.den = 90000;
   pCodecCtx->ticks_per_frame = 1; // <- default???

Still, no matter what I change, my decoding pipeline never sets any 
timestamp. After calling avcodec_decode_video2 I get:

   myAvFrame->pts = AV_NOPTS_VALUE;
   myAvFrame->pkt_pts = AV_NOPTS_VALUE;
   myAvFrame->pkt_dts = AV_NOPTS_VALUE;

   myAvPacket->pts = AV_NOPTS_VALUE;
   myAvPacket->dts = AV_NOPTS_VALUE;

Which makes no sense to me, at this point I'm unable to synchronize as I 
don't know the timestamp for my frame.

I do have timestamps for each of the packets I send to 
avcodec_decode_video2, but they are not increasingly monotonic 
(B-frames) and I don't know which one to use for the decoded frame.

Any help is welcome


Saludos / Best regards,

*Sergio Basurco*

More information about the ffmpeg-user mailing list