ffmpeg的avformat_open_input总是返回“找不到协议” RV =( - 1330794744)

问题描述 投票:8回答:3

试图让ffmpeg的Visual Studio 2010中到目前为止,所有ffmpeg的头文件和库工作被加载,没有出现错误或警告。

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 =“协议未找到”)。试过86和64头和32位上的XP和64位W7库。无论我提出的 “myfile.ext”(试图 “file1.avi”, “文件= C:\ file1.avi”, “http://www.someweb.com/file1.avi”,甚至是空的char * “”)反应总是 “找不到协议”。有任何想法吗?

windows visual-studio-2010 visual-c++ ffmpeg
3个回答
8
投票

我有同样的问题。正确的初始化

av_register_all();

0
投票

我希望他能帮助别人。因为我有同样的问题,在我的代码工作在Android和Linux,但不能在MacOS和自av_register_all现在已经过时(用于FFMpeg version > 4.0)从discomurray答案并没有解决这个问题对我来说。

它为什么没有我的情况下工作的原因是,我已经在我的系统这是在/usr/local/lib/可惜它不是我的情况正确配置(或与一个我自己编的不匹配版本)上已经安装了libavformat。

我所做的是,我添加的路径,我的构建执行命令之前DYLD_LIBRARY_PATH(MacOS的):

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/xxx/projects/FFmpeg/libavformat

在Linux上,你可以做LD_LIBRARY_PATH相同


0
投票
try to change file path 
"/home/user/video.mp4" -> "file:/home/usr/video.mp4"

愿你应该逃脱“:”字符,除非协议 检查此链接ffmpeg-protocols#file

© www.soinside.com 2019 - 2024. All rights reserved.