The FFmpeg VS Project Generator is a standalone program that can be used to create a custom Visual Studio project within a FFmpeg source code distribution. This program allows for the created Visual Studio project to be customised using virtually any of the options supported by FFmpegs default configure script. This allows for selecting which dependency libraries and codec/format support should be built into the created project file. With the output project FFmpeg libraries and programs can be built and debugged directly within Visual Studio.
FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata. https://ffmpeg.org
Pre-built executables are available from the releases page in a single archive containing both 32bit and 64bit versions.
This project comes with the project_generate program which can be used to build custom project files. This program accepts many of the configuration parameters that are supported by FFmpegs standard configure script (see FFmpegs documentation for more details). These options can be used to disable/enable specific options that define how FFmpeg is built. Using project_generate a new project can be built using these options.
To generate a custom project using different configuration options simply build project_generate and then run it by passing in the desired config options. In order for the generator to run it must have access to the ffmpeg source files that should be built into the new generated project. The generator will search for the source configure file in order to find what options are avilable for the current sources. This file must be accessible for the program to run, if the generator cannot find the configure files location then the input command option --rootdir= can be used to specify its location.
For example to build FFmpeg without any additional dependencies:
project_generate.exe --enable-gpl --enable-version3 --disable-bzlib --disable-iconv --disable-zlib --disable-lzma --disable-sdl --toolchain=msvc
As well as enabling/disabling dependency libraries, specific config options can also be enabled/disabled. For instance a project that does not require yasm can be built by passing --disable-yasm. Specific FFmpeg programs can also be disabled such as --disable-ffprobe which will prevent a project file being generated for the FFmpeg program ffprobe.
The generator is designed to automatically resolve dependencies so if a configure option is disabled all options that depend on it will also be disabled accordingly.
For a complete list of available commands the --help option can be passed to the generator. This will give the complete list of accepted options based on the current sources.
By default the generator will build a project using the latest available toolchain detected on the host computer. This can be changed by hand in the generated projects properties Project Configuration->General->Platform Toolset if an older toolset is desired. The generator also supports use of the Intel compiler. The --toolchain= option can be used to change between standard Microsoft compiler (msvc) and the Intel compiler (icl).
Note: FFmpeg requires C99 support in order to compile. Only Visual Studio 2013 or newer supports required C99 functionality and so any older version is not supported. Visual Studio 2013 or newer is required. If using an older unsupported version of Visual Studio the Intel compiler can be used to add in the required C99 capability.
The project generator will also check the availability of dependencies. Any enabled options must have the appropriate headers installed in *OutputDir otherwise an error will be generated.
Sevaral automated batch files are supplied with the project that can be used to generate FFmpeg projects based on dependencies provided by ShiftMediaProject (smp_project_generate_gpl etc.). These batch files can be used to build projects based on various configurations and they can also optionally download all the appropriate dependency libraries that are supplied by ShiftMediaProject.
- OutputDir is the Output Directory specified in the project properties.
Note: There is a different OutputDir for 32/64bit configurations. Lib's and DLL's should be placed in the correct directory.
Any header files will need to be placed in the Output directories include folder OutputDir\include.
By default the 32bit lib OutputDir is OutputDir/lib/x86 and 64bit is OutputDir/lib/x64. DLLs follow a similar scheme except using OutputDir/bin/x86 and for 64bit OutputDir/bin/x64.
The default value of OutputDir is ....\msvc relative to the FFmpeg source directory. An example of the expetced directory structure is:- msvc (OutputDir)
- source >
- FFmpeg
- ..Any other libraries source code..
Many of the possible FFmpeg dependencies (and their dependencies) are provided by the ShiftMediaProject repositories.
Many of the possible FFmpeg dependencies (and there dependencies) are available in the ShiftMediaProject repositories. However the following is a list of extra dependency options that require external downloads if used:
- opengl (requires glext)
- Download glext.h and wglext.h from opengl.org.
- Save the header files into OutputDir/include/gl/*.
- opencl (requires latest Intel/AMD OpenCL or NVIDIA CUDA SDK)
- Download either the "Intel OpenCL SDK", "AMD OpenCL SDK" or the "NVIDIA CUDA SDK" from their respective suppliers.
- Install the downloaded SDK wherever desired.
- ffnvcodec/nvdec/nvenc (requires nv-codec-headers)
- Download the nv-codec-headers repository from https://github.com/FFmpeg/nv-codec-headers
- Save the contents of the nv-codec-headers repositories "include" folder into "OutputDir/include/*".
- cuda-sdk (requires latest NVIDIA CUDA SDK)
- Download the NVIDIA CUDA SDK from the NVIDIA website
- Install the downloaded SDK wherever desired.
- amf (requires Advanced Media Framework (AMF) SDK headers)
- Download the AMF repository from https://github.com/GPUOpen-LibrariesAndSDKs/AMF
- Save the contents of the AMF repositories "amf/public/include" into "OutputDir/include/AMF/*".
- decklink (requires Blackmagic DeckLink SDK)
- Download the "Blackmagic DeckLink SDK" from the Blackmagic website.
- Extract the downloaded SDK wherever desired.
- Run the following command from a Visual Studio developer command prompt in the "Win/include" folder: midl /win32 /h DeckLinkAPI.h DeckLinkAPI.idl
- Copy the newly created "DeckLinkAPI.h" and "DeckLinkAPI_i.c" files to OutputDir/include/*.
- vulkan (requires Vulkan headers or Vulkan SDK)
- Download the Vulkan SDK from https://www.lunarg.com/vulkan-sdk/
- Install the downloaded SDK wherever desired. or
- Download the vulkan-headers repository from https://github.com/KhronosGroup/Vulkan-Headers
- Save the contents of the vulkan-headers repositories "include" folder into "OutputDir/include/*".
Any dependencies supplied by ShiftMediaProject should be downloaded next to the FFmpeg folder as they will use the same OutputDir location. Projects to build each dependency can be found in the respective repository ./SMP directories.
Only dependencies built from supplied ShiftMediaProject repositories are tested and supported. Using compiled dependencies from other sources may result in version or other issues. Although these external sources generally work fine any problems associated with them are not covered by ShiftMediaProject and so they should be used with discretion.
If the enable-nasm option is used to generate a project then in order to use the output project file using msvc you must first download and install NASM. NASM is required to compile all used assembly files.
- Visual Studio NASM integration can be downloaded from https://github.com/ShiftMediaProject/VSNASM/releases/latest
- Once downloaded simply follow the install instructions included in the download.
Note: Older source versions of FFmpeg used YASM for assembly compilation instead of NASM if using an older source release then YASM integration will be needed instead. The installation of YASM is identical to that of NASM https://github.com/ShiftMediaProject/VSYASM/releases/latest
FFVS-Project-Generator itself is released under LGPLv2. The generated output project(s) and source can be used with existing FFmpeg source code such that any resultant binaries created by the generated projects will still conform to the license of the FFmpeg source code itself. This means the output binaries are licensed based on the command line specified when generating the projects (i.e. --enable-gpl etc.).