FFmpeg:协议不在白名单中 'file'!
FFmpeg: Protocol not on whitelist 'file'!
我想从 RTP 流中读取,但是当我将 "test.sdp" 指定为 avformat_open_input()
时,我收到此消息:
[rtp @ 03928900] Protocol not on whitelist 'file'!
Failed: cannot open input.
avformat_open_input() fail: Invalid data found when processing input
通常,如果我在控制台上使用 ffplay,我会添加选项 -protocol_whitelist file,udp,rtp
,它会正常工作。
所以我尝试了这个:
AVDictionary *d = NULL;
av_dict_set(&d, "protocol_whitelist", "file, udp, rtp", 0);
ret = avformat_open_input(&inFormatCtx, filename, NULL, &d);
但仍然弹出相同的消息。有什么想法吗?
编辑:这个答案适用于某些版本。您应该使用 avformat_open_input 的选项参数,如 bot1131357 的回答
中所述
我对此不是很确定,但我相信这个选项会进入 AVFormatContext
AVFormatContext* formatContext = avformat_alloc_context();
formatContext->protocol_whitelist = "file,udp,rtp";
if (avformat_open_input(&formatContext, uri.c_str(), NULL, NULL) != 0) {
return EXIT_FAILURE;
}
看看这个变化的cvs日志:
https://ffmpeg.org/pipermail/ffmpeg-cvslog/2016-March/098694.html
这很尴尬...
avformat_open_input
失败,因为我有空格。删除空格现在有效。
av_dict_set(&d, "protocol_whitelist", "file,udp,rtp", 0);
我想从 RTP 流中读取,但是当我将 "test.sdp" 指定为 avformat_open_input()
时,我收到此消息:
[rtp @ 03928900] Protocol not on whitelist 'file'!
Failed: cannot open input.
avformat_open_input() fail: Invalid data found when processing input
通常,如果我在控制台上使用 ffplay,我会添加选项 -protocol_whitelist file,udp,rtp
,它会正常工作。
所以我尝试了这个:
AVDictionary *d = NULL;
av_dict_set(&d, "protocol_whitelist", "file, udp, rtp", 0);
ret = avformat_open_input(&inFormatCtx, filename, NULL, &d);
但仍然弹出相同的消息。有什么想法吗?
编辑:这个答案适用于某些版本。您应该使用 avformat_open_input 的选项参数,如 bot1131357 的回答
中所述我对此不是很确定,但我相信这个选项会进入 AVFormatContext
AVFormatContext* formatContext = avformat_alloc_context();
formatContext->protocol_whitelist = "file,udp,rtp";
if (avformat_open_input(&formatContext, uri.c_str(), NULL, NULL) != 0) {
return EXIT_FAILURE;
}
看看这个变化的cvs日志: https://ffmpeg.org/pipermail/ffmpeg-cvslog/2016-March/098694.html
这很尴尬...
avformat_open_input
失败,因为我有空格。删除空格现在有效。
av_dict_set(&d, "protocol_whitelist", "file,udp,rtp", 0);