FFmpeg programming environment to build the VS

ffmpeg download link: https://ffmpeg.zeranoe.com/builds/

There are two parts: shared and dev, shared dynamic link library contains, dev contains the header files and lib files.

After decompression in the share bin directory and internal dev include and lib files are placed in the same directory, such as D: \ ffmpeg-4.2.2-win64.

New environment variable name FFMPEG_DIR, is D: \ ffmpeg-4.2.2-win64, editing system environment variable path, increase% FFMPEG_DIR% \ bin (the part can make automatic calls upon the relevant dll exe run the compiled without dll to exe directory separately copy).

New project: File -> New -> Project -> Win32 console application, change the configuration manager to 64, note 64 libraries during download.

Open the Properties panel: Solution Explorer -> Right-click the project -> Properties
header configuration: Configuration Properties -> C / C ++ -> General -> Additional Include Directories, enter "$ (FFMPEG_DIR) \ include"
Import Library Configuration :
configuration properties -> linker -> General -> additional library directories, enter "$ (FFMPEG_DIR) \ lib"
configuration properties -> linker -> input -> additional dependencies, corresponding to the input FFMPEG library avcodec.lib; avdevice .lib; avfilter.lib; avformat.lib; avutil.lib; postproc.lib; swresample.lib; swscale.lib;
dynamic libraries without configuration.

note:

Used in VC FFMPEG compiled libraries, only need to include the include and lib file on the line, need to do the following steps. (This method is suitable for their own use MinGW compiled library, also applies to downloaded from the Internet compiled libraries, such as http://ffmpeg.zeranoe.com/builds/ )

(1) will include the inttypes.h, stdint.h under mingw installation directory, _mingw.h three copying your files in the directory include ffmpeg library
at the end (2) in _mingw.h file (in # before endif line) added a line:
#define __restrict__ are
(2) all the long long into the __int64, if it is directly vs2008 compiler, then this modification should not be required (this step I have not encountered)
(3 ) modify .cpp file

#include "stdio.h"
#include "stdlib.h"
#include "string.h"

#define __STDC_CONSTANT_MACROS
#ifdef __cplusplus
extern "C"

#endif
{
        #include "ffmpeg/avutil.h"
        #include "ffmpeg/avcodec.h"
        #include "ffmpeg/avformat.h"

#ifdef __cplusplus
}
#endif

(4) If you encounter error C3861: 'UINT64_C': identifier not found
added is defined as follows in common.h:
#ifndef INT64_C
#define INT64_C (C) (C ## LL)
#define UINT64_C (C) (C ## ULL)

#endif

Published 18 original articles · won praise 8 · views 10000 +

Guess you like

Origin blog.csdn.net/zengshaoqing/article/details/105186343