Is it possible to compile ffmpeg in visual studio

2019-03-16 11:23发布

问题:

Is it possible to compile the sourcecode from ffmpeg in visual studio 2010? Is it difficult?

Just looking for some advice (and instructions) if possible. :-)

Cheers,

Pete

回答1:

It is not possible because ffmpeg makes extensive use of C99 features (with good reason), and MSVC doesn't support nearly enough nook and crannies of the standard.

You can however, use the C library built by MinGW for use with Visual Studio projects. See the following links for all the information you need:

  1. Information about building/using the library on Windows with Visual Studio: http://ffmpeg.arrozcru.org/wiki/index.php?title=Main_Page
  2. Downloads: http://ffmpeg.arrozcru.org/autobuilds/


回答2:

Apparently someone at Google has written a C99 to C89 "downconverter" in part to get ffmpeg to compile with Visual Studio:

http://blogs.gnome.org/rbultje/2012/09/27/microsoft-visual-studio-support-in-ffmpeg-and-libav/

The tool they wrote is currently only in source code form. Although that tool is written in C, it uses some compiler specific includes, specific to the Clang compiler, so you currently need clang to compile it. I had to get all the pieces to Clang (which relies on llvm) and compile with VS2010. OK, got that figured out, so now I have the two tools compiled: c99wrap.exe and c99conv.exe.

The blog does not mention two important things that are mentioned here:

http://libav.org/platform.html#Microsoft-Visual-C_002b_002b

First, you have to ensure the link.exe you use is the Visual C linker and not the mingw linker. Also, the msvc toolchain under msys does not yet support shared DLL builds, it only supports static lib builds at this time, so --enabled-shared fails to link.



回答3:

Of course it is possible

To use FFmpeg SVN libraries with your Microsoft Visual C++ project, you must first make sure your Microsoft Visual C++ build system has the inttypes.h and stdint.h include files.

How do I know if I have those files? Well... unless you already did this and know you have that file, you don't have it. MSVC++ does not adhere to the C99 standard, where that file is specified, so you're on your own here.

Alexander Chemeris was nice enough to make such files for Microsoft Visual C++, so they can be found here

Download latest archive from link above and unpack it to the folder to which you installed FFmpeg's include files. The default path is /usr/local/include, which is, in this guide for Windows, C:\msys\local\include.

Inttypes C99



回答4:

Visual Studio 2013 provides the support for C99 which was missing earlier. With this ffmpeg can now be built using Visual Studio 2013. You can read more about the new language/libraries features here.

Also, try out Visual Studio 2013 RC here.



回答5:

According to the documentation it is not possible.