[Libav-user] Read RTCP lost packets info

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Jun 13 12:34:56 EEST 2018

2018-06-11 16:17 GMT+02:00, Vitor Vanacor <vitorvanacor at gmail.com>:
>  It seems to be something trivial, but I couldn't find a way to get the
> information of the packets lost, usually sent by RTCP in RTP streams.
> I've seen this question (
> https://stackoverflow.com/questions/20265546/reading-rtcp-packets-from-an-ip-camera-using-ffmpeg)
> about reading RTCP packets, but I have two issues with it:
> 1. It uses RTSP structures. In my case, the RTP stream is not necessarily
> RTSP, so I imagine it wouldn't work.
> 2. Even if it was (or worked without RTSP), it uses the rtsp.h header, and
> as far as I understand this file functions are not exposed (the only
> exposed headers in /libavformat when compiling FFmpeg are avio.h,
> libavformat.h and version.h. Maybe I'm wrong here?)

This is correct, you cannot use these functions in a portable way.

> I also found this function (
> https://www.ffmpeg.org/doxygen/3.0/rtpdec_8c.html#a7775bfcc7505137bfa63f5610908a659)
> in the rtpdec.h that calculates the packet loss using the RTPStatisticsread
> from RTPDemuxContext. But I don't understand how I would access this
> RTPDemuxContext (the function I found that returns this structure is in
> rtsp.h, so I'd be back to the previously mentioned problem).

You cannot access them but I believe an error is printed on the console
every time a sequence error occurs, no?

> So, any help regarding these doubts that I have or another different way to
> extract the packet loss information would be appreciated!

This appears only to be implemented for internal use.

Carl Eugen

More information about the Libav-user mailing list