[Libav-user] Mapping RTP timestamps to AVFrame timestamps

Rasmus Diederichsen rasmus at psiori.com
Wed Feb 5 14:45:35 EET 2025


Hello,
I have a custom webrtc application, in which I use ffmpeg to encode video to RTP, transport the packets via webrtc, and decode via ffmpeg.
From the RTCP sender reports generated by ffmpeg, I can also obtain an (unfortunately seemingly inaccurate) mapping from rtp packet timestamps to ntp timestamps. However, after assembling the AVPackets, or decoding into AVFrame, i fail to find the relationship between the AVFrame timestamp and the RTP packet timestamps that made up this frame.

Is there a way to determine what the ntp timestamp for an AVFrame ist according to its constituent packets? Or is the only way to relate the two to check what is the timestamp of the last packet going into the decoder before a frame is received? I would expect this solution to be brittle, since i dont necessarily know if the decoder might be buffering frames internally, depending on settings.

Best,
Rasmus


More information about the Libav-user mailing list