【发布时间】:2015-09-28 09:20:38
【问题描述】:
所以我尝试在 c++ 中使用 ffmpeg。我的代码是这样的:
#include <iostream>
extern "C"
{
#include "libavcodec\avcodec.h"
#include "libavformat\avformat.h"
#include "libswscale\swscale.h"
}
using namespace std;
#pragma comment(lib, "dev/lib/avcodec.lib")
#pragma comment(lib, "dev/lib/avformat.lib")
#pragma comment(lib, "dev/lib/swscale.lib")
int main()
{
avcodec_register_all();
av_register_all();
char inputFile[] = "video.mp4";
AVFormatContext *pFormatCtx;
if (avformat_open_input(&pFormatCtx, inputFile, NULL, 0) != 0) // exception occurs here
{
cout << "could not open file";
return -1;
}
}
此代码在发布模式下运行,但在调试模式下我在avformat_open_input 得到异常:
在 0x0000000074BC3C35 (avformat-55.dll) 中未处理的异常 ingrain.exe: 0xC0000005: 访问冲突读取位置 0xFFFFFFFFFFFFFFFF.
我直接从 ffmpeg 的网站下载了 dll 和 lib,并将它们包含在我的 Visual Studio 2012 项目中。
提前致谢。
【问题讨论】:
标签: c++ visual-studio exception visual-studio-2012 ffmpeg