试图使ffmpeg在Visual Studio 2010中工作。到目前为止,所有ffmpeg header 和库都已加载,没有发生错误或警告。

avcodec_register_all();
AVFormatContext *pFormatCtx = NULL;
char errbuf[256];
pFormatCtx = avformat_alloc_context();
int rv = avformat_open_input(&pFormatCtx, "myfile.ext", NULL, NULL);
if (rv!=0){
    av_strerror(rv, errbuf, sizeof(errbuf));
}

问题是,avformat_open_input始终返回-1330794744(errbuf =“找不到协议(protocol)”)。在32位XP和64位W7上尝试了x86和x64 header 和库。无论我为“myfile.ext”(尝试“file1.avi”,“file = c:\file1.avi”,“http://www.someweb.com/file1.avi”,甚至是空char *“”)输入什么,始终都是“找不到协议(protocol)”。有任何想法吗?

最佳答案

我遇到了同样的问题。正确的初始化是

av_register_all();

关于windows - ffmpeg avformat_open_input始终返回 "Protocol not found"rv =(-1330794744),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14914634/

10-11 06:22