1
所以我試圖在C++中使用ffmpeg。我的代碼是這樣的:僅在調試模式下的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)
未處理異常 阿利
.exe:0xC0000005:訪問衝突讀取位置 0xFFFFFFFFFFFFFFFF。
我從ffmpeg的網站上直接下載了dll和lib,並將它們包含在我的visual studio 2012的項目中。
提前致謝。