【发布时间】:2017-02-08 06:28:13
【问题描述】:
这是我第一次使用 FFmpeg。我尝试使用avformat_open_input 打开的每种媒体文件都会返回“处理输入时发现无效数据”。我正在使用 32 位 FFmpeg 构建版本:92de2c2。我根据这个答案设置了我的 VS2015 项目:Use FFmpeg in Visual Studio。这段代码可能出了什么问题?
#include "stdafx.h"
#include <stdio.h>
extern "C"
{
#include "libavcodec/avcodec.h"
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
}
int main(int argc, char *argv[])
{
AVFormatContext *pFormatCtx = NULL;
avcodec_register_all();
const char* filename = "d:\\a.mp4";
int ret = avformat_open_input(&pFormatCtx, filename, NULL, NULL);
if (ret != 0) {
char buff[256];
av_strerror(ret, buff, 256);
printf(buff);
return -1;
}
}
【问题讨论】:
-
您是否尝试过其他视频文件?有时这个错误意味着输入文件的格式无效。
-
是的,我尝试了几种不同的视频文件和格式,包括 mp4、mkv、avi、mp3。我知道这些文件可以工作,因为当我通过 ffmpeg.exe 处理它们时,它们的处理没有问题
标签: visual-c++ visual-studio-2015 ffmpeg