Reading RTCP packets from an IP camera using FFMPEG

眉间皱痕 提交于 2019-12-30 05:28:10

问题


I am using the ffmpeg C library. I need to intercept RTCP packets from the camera in order to get the timestamp from the Sender Report. Is there any method or structure in the ffmpeg that gives me this information? I am completely stuck but I am not able to solve that problem.

Any help will be appreciated. Thanks in advance,


回答1:


Finally I had to hack into the ffmpeg library like this:

// Patch for retrieving inner ffmpeg private data
RTSPState* rtsp_state = (RTSPState*) context->priv_data;
RTSPStream* rtsp_stream = rtsp_state->rtsp_streams[0];
RTPDemuxContext* rtp_demux_context = (RTPDemuxContext*) rtsp_stream->transport_priv;

// Decode the NTP time from the 64 bit structure
uint64_t ntp_time = rtp_demux_context->last_rtcp_reception_time;
uint32_t seconds = (uint32_t) ((ntp_time >> 32) & 0xffffffff);
uint32_t fraction  = (uint32_t) (ntp_time & 0xffffffff);
double useconds = ((double) fraction / 0xffffffff);

And I finally get timestamp information.



来源:https://stackoverflow.com/questions/20265546/reading-rtcp-packets-from-an-ip-camera-using-ffmpeg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!