FFmpeg: protocol not whitelisted '!

I want to read from the RTP stream, but when I point "test.sdp" to avformat_open_input(), I get this message:

[rtp @ 03928900] Protocol not on whitelist 'file'!
Failed: cannot open input.
avformat_open_input() fail: Invalid data found when processing input

Usually, if I used ffplay on the console, I would add an option -protocol_whitelist file,udp,rtp, and it will work fine.

So, I tried this:

AVDictionary *d = NULL;           
av_dict_set(&d, "protocol_whitelist", "file, udp, rtp", 0); 
ret = avformat_open_input(&inFormatCtx, filename, NULL, &d);

But the same message pops up. Any ideas?

+4
source share
2 answers

It is not comfortable...

avformat_open_inputfailed because i have spaces. Removing spaces now works.

av_dict_set(&d, "protocol_whitelist", "file,udp,rtp", 0); 
+3
source

EDIT . This answer works up to some version. You should use options avformat_open_input parameter as described in bot1131357 answer


, , 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

0

Source: https://habr.com/ru/post/1653955/


All Articles