Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/155.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FFmpeg-RTCP字节包 我正在做一些依赖Wi-Fi RAK5206电子板的C++项目。我使用ffmpeg库来获取视频和音频流,我有一个问题,我可以启动和停止流四次,但当我想启动第五次时,我得到了错误。错误描述是处理输入时发现的无效数据,当我调用avformat\u open\u input功能,需要重新启动电子板,重新连接到Wi-Fi等时发生_C++_Ffmpeg_Rtp_Rtcp - Fatal编程技术网

FFmpeg-RTCP字节包 我正在做一些依赖Wi-Fi RAK5206电子板的C++项目。我使用ffmpeg库来获取视频和音频流,我有一个问题,我可以启动和停止流四次,但当我想启动第五次时,我得到了错误。错误描述是处理输入时发现的无效数据,当我调用avformat\u open\u input功能,需要重新启动电子板,重新连接到Wi-Fi等时发生

FFmpeg-RTCP字节包 我正在做一些依赖Wi-Fi RAK5206电子板的C++项目。我使用ffmpeg库来获取视频和音频流,我有一个问题,我可以启动和停止流四次,但当我想启动第五次时,我得到了错误。错误描述是处理输入时发现的无效数据,当我调用avformat\u open\u input功能,需要重新启动电子板,重新连接到Wi-Fi等时发生,c++,ffmpeg,rtp,rtcp,C++,Ffmpeg,Rtp,Rtcp,我使用Wireshark应用程序发现VLC正在工作,当调用TEARDOWN时,它正在发送一些BYE数据包。我想知道错误是否取决于他们,因为从我的应用程序,我不发送。如何设置强制ffmpeg发送BYE数据包 我在文件中找到了一些要设置选项的声明,并在需要连接时尝试了这些声明,但显然没有成功。 我用于设置选项和打开输入的代码: AVDictionary* stream_opts = 0; av_dict_set(&stream_opts, "rtpflags", "send_bye", 0)

我使用Wireshark应用程序发现VLC正在工作,当调用
TEARDOWN
时,它正在发送一些BYE数据包。我想知道错误是否取决于他们,因为从我的应用程序,我不发送。如何设置强制ffmpeg发送BYE数据包

我在文件中找到了一些要设置选项的声明,并在需要连接时尝试了这些声明,但显然没有成功。 我用于设置选项和打开输入的代码:

AVDictionary* stream_opts = 0;
av_dict_set(&stream_opts, "rtpflags", "send_bye", 0);
avformat_open_input(&format_ctx, url.c_str(), NULL, &stream_opts);

确保您正在从应用程序调用此av_write_trail函数

如果没有,请调试并检查它

/* Write the trailer, if any. The trailer must be written before you
     * close the CodecContexts open when you wrote the header; otherwise
     * av_write_trailer() may try to use memory that was freed on
     * av_codec_close(). */
    av_write_trailer(oc);
来自ffmpeg源的函数调用流代码段:

    av_write_trailer -> 
    ....
    ret = s->oformat->write_trailer(s);
    } else {
        s->oformat->write_trailer(s);
    }
    ...
    .write_trailer  = rtp_write_trailer  -> 
    ...
    if (s1->pb && (s->flags & FF_RTP_FLAG_SEND_BYE))
       rtcp_send_sr(s1, ff_ntp_time(), 1)

解决了将标志16(二进制:10000)添加到
AVFormatContext
对象标志的问题

formatCtx->flags = formatCtx->flags | 16;
根据:


当您想将数据保存到文件中,但我没有写入文件时,似乎会使用该选项。我正在解码的视频/音频数据包,转换成字节,并在应用程序中进一步处理。请您查看ffmpeg源代码,了解更多详细信息。
#define FF_RTP_FLAG_SEND_BYE  16