使用FFMPEG IP摄像机读取RTCP包 [英] Reading RTCP packets from an IP camera using FFMPEG

查看:1119
本文介绍了使用FFMPEG IP摄像机读取RTCP包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的ffmpeg C ++库。我需要拦截从照相机RTCP分组,以获得从所述发送者报告的时间戳。是否有这给了我这些信息的ffmpeg的任何方法或结构?我完全被卡住,但我不能够解决这个问题。

I am using 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.

任何帮助将AP preciate。由于提前,

Any help will be appreciate. Thanks in advance,

推荐答案

最后,我不得不攻入的ffmpeg库是这样的:

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.

这篇关于使用FFMPEG IP摄像机读取RTCP包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆