I just downloaded the dev package for ffmpeg and was setting up headers and libraries for use. I'm using Visual C++ 2013 and I added the path of the ffmpeg header files and libs. I linked to every single lib file in the ffmpeg lib
folder and apparently none of them matched av_register_all
and avformat_open_input
.
Here's the output from trying to build:
1>------ Build started: Project: ffmpeg_learning, Configuration: Debug Win32 ------
1> ffmpeg_learning.cpp
1>ffmpeg_learning.obj : error LNK2019: unresolved external symbol _av_register_all referenced in function _main
1>ffmpeg_learning.obj : error LNK2019: unresolved external symbol _avformat_open_input referenced in function _main
1>c:\users\edward severinsen\documents\visual studio 2013\Projects\ffmpeg_learning\Debug\ffmpeg_learning.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here's my code:
#include "stdafx.h"
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
#pragma comment(lib, "avcodec.lib")
#pragma comment(lib, "avformat.lib")
#pragma comment(lib, "swscale.lib")
#pragma comment(lib, "avdevice.lib")
#pragma comment(lib, "avutil.lib")
#pragma comment(lib, "avfilter.lib")
#pragma comment(lib, "postproc.lib")
#pragma comment(lib, "swresample.lib")
int main(int argc, char* argv[])
{
av_register_all();
AVFormatContext* pFormatCtx = NULL;
//Open video file
if (avformat_open_input(&pFormatCtx, argv[1], NULL, 0))
{
//Couldn't open the file
return -1;
}
return 0;
}
I have no idea what I'm missing. Any help would be much appreciated. Thanks.