Because VS2013 support C99, so, you can directly use VS2013 for FFMPEG compilation and debugging, and no longer use Eclipse toss. Referring to others, the record is as follows:
Specific steps:
1. Download FFMPEG source code, download address: http://ffmpeg.zeranoe.com/builds/ or http://ffmpeg.org/download.html
2. Download the MinGW installer, download address: http://www.mingw.org/ or http://sourceforge.net/projects/mingw/files/latest/download?Source =files install after download, click run after install, mark the following items:
Then, under the Installation menu, click Apply Changes (mingw32-gcc-g++ is not selected);
Download msys2 http://sourceforge.net/projects/msys2/ download after installation to the mingw/msys2/directory
Download YASM at http://yasm.tortall.net/; Please do not download the VS version, but download the 64-bit version. After downloading, rename it to yasm.exe and copy it to the usr/bin directory of msys2.
4. Configuration C:/MinGW msys/1.0/msys. Bat, in the front of this file (@ echo off after) add a line the following contents:
(The same is true for MSYS2)
Call “D:\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat”; call “D:\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat”
5. Rename the C:/MinGW msys/1.0/bin/link. Exe for link_renamed. Exe (in accordance with the actual installation path) choice, this step is to prevent the link. Exe and vc link. Exe conflict, after the completion of the compilation can modify the back; Vc /bin link. Exe lib. Exe.
6. Configure compilation, double click msys.bat, go to the FFMPEG source code root directory, can run./configure –help to view the compilation configuration options, I used the option:
Static library:./configure –enable-static –prefix=./vs2013_build –enable-debug –toolchain= MSVC
Dynamic library:./configure –enable-shared –prefix=./vs2013_build –enable-debug –toolchain= MSVC
— — — — — — — — — — — — — — — — — — note:
The default is enable-yasm, and you can –disable-asm disable all assembly optimizations if you don’t want them
For libraries that generate release mode, you can –disable-debug to remove the debug message
Static library:./configure –enable-static –prefix=./vs2013_build_release –disable-debug –toolchain= MSVC — enable-memalligate-hack
For libraries that generate Debug mode, it seems that the top approach is fine, but to be safe in order to step into any function, set it as follows:
./configure –enable-static –prefix=./vs2013_build_noyasm –enable-debug –toolchain= MSVC –disable-yasm — disable-memalloce-hack
—————–
Wait for the configuration to return;
7. Type make all to compile;
8. Type make install.
If you have any problems, make for msys2 can enter the msys environment, run the pacman -s make may refer to http://m.oschina.net/blog/363658
The generated header files and libraries are in the vs2013_build directory under the FFMPEG source code.
Create a project FFMEPG_TEST (static)
Find a file in share/example, such as avio_reading.c, and place it in your project
Add the include directory and lib directory: C++->; Conventional – & gt; ADD INCLUDE DIRECTORY ADD INCLUDE LINKER ADD LIB
Add to lib:
advapi32.lib; Secur32.lib; ws2_32.lib; libavcodec.a; libavdevice.a; libavfilter.a; libavformat.a; libavutil.a; libswresample.a; libswscale.a;
———————————————–
Inline error is encountered during compilation because VS2013 uses its own _inline
#define inline _inline in a file
Then, the default library “MSVCRTD” conflicts with other libraries
Solution:
Properties – C++->; Code Generation -> runtime changed to multithreading /MT
/NODEFAULTLIB:libcmt.lib: /NODEFAULTLIB:libcmt.lib: /NODEFAULTLIB:libcmt.lib: /NODEFAULTLIB:libcmt.lib
The avcodec_alloc_frame() function received an error
Replace avcodec_alloc_frame() with av_frame_alloc().
Compile successfully
The scheme used for compiling 64-bit is MSYS2 + MINGW64
After installing MSYS2, in the directory
Pacman-S make GCC diffutils mingw64-x86_64-toolchain
Rename /usr/bin/link.exe to /usr/bin/link.bak to avoid conflicts with MSVC’s link.exe.
04 configuration msys2
04.01 edit the C:/msys64/msys2_shell. CMD,
Rem set MSYS2_PATH_TYPE=inherit: set MSYS2_PATH_TYPE=inherit
Open the MSYS2 window associated with VS2015
In the Command Prompt window, type:
# Switch to C: /msys64 directory CD C: /msys64 # Switch to VS2016 64-bit environment C:\
PR
Ogram Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat # Open mingw64 window msys2_shel.cmd-mingw64 of msys2
04.03 Check tool components
/ C/ Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/cl /c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/link /usr/ BIN/ yasm /usr/ BIN/ CPP
Modify the MSYS2 window code page to GBK to avoid displaying garbled code at compile time.
Right-click on the window, select the [Options] menu, select [Text], locale select: zh_CN, Character set select GBK. –arch=x86_64 make
After configuring the config, it may still be x86, open the config file, and change the corresponding value to 0
Read More:
- Vs2015 compiling ffmpeg source code
- Ffmpeg (libx264) compiling for IOS
- Methods of compiling and installing ffmpeg and libx264 in Linux
- Vs2012 compiling PCL dependency library vtk7.0
- Small problems encountered in compiling OpenGL under VS2010
- DirectX encountered “unresolved external symbol” when compiling on vs2015__ The solution and reason of “vsnwprintf”
- Summary of problems encountered in compiling and installing vtk7 + vs2013 / 2015 + cmake
- Vs compiling OpenGL project, the solution of unable to open the source file “GL / glaux. H” appears
- Solution of error msb3073 when compiling with vs
- Compiling QT project under vs encountered “error 89error msb6006:“ cmd.exe ”Exited with code 3
- OpenGL environment configuration under VS2010 / vs2012 / vs2015
- Vtk7. X is compiled and installed under vs2013 and vs2015
- Opencv2.4.9 + ffmpeg1.2.12 installation configuration and problem solution under Ubuntu 14.04
- Common compatibility problems of VS2010 to vs2017 projects
- How to Solve MacOS ffmpeg killed Error
- [pit filling] problem summary of upgrading VS2010 project to vs2017
- After vs2019 is installed, the original vs2017 project cannot compile various error reports
- [VTK] cmake compiling VTK
- Conversion of audio file format with ffmpeg command
- Cmake compile opencv report error qtcore_ DIR QtOpenglDIR QtGui_ Dir ffmpeg loading failed