General Documentation

Table of Contents


1. external libraries

FFmpeg can be hooked up with a number of external libraries to add support for more formats. None of them are used by default, their use has to be explicitly requested by passing the appropriate flags to ‘./configure’.

1.1 OpenCORE AMR

FFmpeg can make use of the OpenCORE libraries for AMR-NB decoding/encoding and AMR-WB decoding.

Go to http://sourceforge.net/projects/opencore-amr/ and follow the instructions for installing the libraries. Then pass --enable-libopencore-amrnb and/or --enable-libopencore-amrwb to configure to enable the libraries.

Note that OpenCORE is under the Apache License 2.0 (see http://www.apache.org/licenses/LICENSE-2.0 for details), which is incompatible with the LGPL version 2.1 and GPL version 2. You have to upgrade FFmpeg’s license to LGPL version 3 (or if you have enabled GPL components, GPL version 3) to use it.

2. Supported File Formats and Codecs

You can use the -formats and -codecs options to have an exhaustive list.

2.1 File Formats

FFmpeg supports the following file formats through the libavformat library:

NameEncodingDecodingComments
4xmX4X Technologies format, used in some games.
8088flex TMVX
Adobe FilmstripXX
Audio IFF (AIFF)XX
American Laser Games MMXMultimedia format used in games like Mad Dog McCree.
3GPP AMRXX
Apple HTTP Live StreamingX
ASFXX
AVIXX
AVISynthX
AVSXMultimedia format used by the Creature Shock game.
Beam Software SIFFXAudio and video format used in some games by Beam Software.
Bethesda Softworks VIDXUsed in some games from Bethesda Softworks.
BinkXMultimedia format used by many games.
Bitmap Brothers JVXUsed in Z and Z95 games.
Brute Force & IgnoranceXUsed in the game Flash Traffic: City of Angels.
Interplay C93XUsed in the game Cyberia from Interplay.
Delphine Software International CINXMultimedia format used by Delphine Software games.
CD+GXVideo format used by CD+G karaoke disks
Core Audio FormatXXApple Core Audio Format
CRC testing formatX
Creative VoiceXXCreated for the Sound Blaster Pro.
CRYO APCXAudio format used in some games by CRYO Interactive Entertainment.
D-Cinema audioXX
Deluxe Paint AnimationX
DFAXThis format is used in Chronomaster game
DV videoXX
DXAXThis format is used in the non-Windows version of the Feeble Files game and different game cutscenes repacked for use with ScummVM.
Electronic Arts cdataX
Electronic Arts MultimediaXUsed in various EA games; files have extensions like WVE and UV2.
FFM (FFserver live feed)XX
Flash (SWF)XX
Flash 9 (AVM2)XXOnly embedded audio is decoded.
FLI/FLC/FLX animationX.fli/.flc files
Flash Video (FLV)XXMacromedia Flash video files
framecrc testing formatX
FunCom ISSXAudio format used in various games from FunCom like The Longest Journey.
GIF AnimationX
GXFXXGeneral eXchange Format SMPTE 360M, used by Thomson Grass Valley playout servers.
id Quake II CIN videoX
id RoQXXUsed in Quake III, Jedi Knight 2, other computer games.
IEC61937 encapsulationXX
IFFXInterchange File Format
Interplay MVEXFormat used in various Interplay computer games.
IV8XA format generated by IndigoVision 8000 video server.
IVF (On2)XXA format used by libvpx
LMLM4XUsed by Linux Media Labs MPEG-4 PCI boards
LXFXVR native stream format, used by Leitch/Harris’ video servers.
MatroskaXX
Matroska audioX
FFmpeg metadataXXMetadata in text format.
MAXIS XAXUsed in Sim City 3000; file extension .xa.
MD StudioX
Mobotix .mxgX
Monkey’s AudioX
Motion Pixels MVIX
MOV/QuickTime/MP4XX3GP, 3GP2, PSP, iPod variants supported
MP2XX
MP3XX
MPEG-1 SystemXXmuxed audio and video, VCD format supported
MPEG-PS (program stream)XXalso known as VOB file, SVCD and DVD format supported
MPEG-TS (transport stream)XXalso known as DVB Transport Stream
MPEG-4XXMPEG-4 is a variant of QuickTime.
MIME multipart JPEGX
MSN TCP webcamXUsed by MSN Messenger webcam streams.
MTVX
MusepackX
Musepack SV8X
Material eXchange Format (MXF)XXSMPTE 377M, used by D-Cinema, broadcast industry.
Material eXchange Format (MXF), D-10 MappingXXSMPTE 386M, D-10/IMX Mapping.
NC camera feedXNC (AVIP NC4600) camera streams
NTT TwinVQ (VQF)XNippon Telegraph and Telephone Corporation TwinVQ.
Nullsoft Streaming VideoX
NuppelVideoX
NUTXXNUT Open Container Format
OggXX
Playstation Portable PMPX
TechnoTrend PVAXUsed by TechnoTrend DVB PCI boards.
QCPX
raw ADTS (AAC)XX
raw AC-3XX
raw Chinese AVS videoXX
raw CRI ADXXX
raw DiracXX
raw DNxHDXX
raw DTSXX
raw E-AC-3XX
raw FLACXX
raw GSMX
raw H.261XX
raw H.263XX
raw H.264XX
raw Ingenient MJPEGX
raw MJPEGXX
raw MLPX
raw MPEGX
raw MPEG-1X
raw MPEG-2X
raw MPEG-4XX
raw NULLX
raw videoXX
raw id RoQX
raw ShortenX
raw TrueHDXX
raw VC-1X
raw PCM A-lawXX
raw PCM mu-lawXX
raw PCM signed 8 bitXX
raw PCM signed 16 bit big-endianXX
raw PCM signed 16 bit little-endianXX
raw PCM signed 24 bit big-endianXX
raw PCM signed 24 bit little-endianXX
raw PCM signed 32 bit big-endianXX
raw PCM signed 32 bit little-endianXX
raw PCM unsigned 8 bitXX
raw PCM unsigned 16 bit big-endianXX
raw PCM unsigned 16 bit little-endianXX
raw PCM unsigned 24 bit big-endianXX
raw PCM unsigned 24 bit little-endianXX
raw PCM unsigned 32 bit big-endianXX
raw PCM unsigned 32 bit little-endianXX
raw PCM floating-point 32 bit big-endianXX
raw PCM floating-point 32 bit little-endianXX
raw PCM floating-point 64 bit big-endianXX
raw PCM floating-point 64 bit little-endianXX
RDTX
REDCODE R3DXFile format used by RED Digital cameras, contains JPEG 2000 frames and PCM audio.
RealMediaXX
RedirectorX
Renderware TeXture DictionaryX
RL2XAudio and video format used in some games by Entertainment Software Partners.
RPL/ARMovieX
Lego Mindstorms RSOXX
RTMPXXOutput is performed by publishing stream to RTMP server
RTPXX
RTSPXX
SAPXX
SDPX
Sega FILM/CPKXUsed in many Sega Saturn console games.
Sierra SOLX.sol files used in Sierra Online games.
Sierra VMDXUsed in Sierra CD-ROM games.
SmackerXMultimedia format used by many games.
Sony OpenMG (OMA)XAudio format used in Sony Sonic Stage and Sony Vegas.
Sony PlayStation STRX
Sony Wave64 (W64)X
SoX native formatXX
SUN AU formatXX
Text filesX
THPXUsed on the Nintendo GameCube.
Tiertex Limited SEQXTiertex .seq files used in the DOS CD-ROM version of the game Flashback.
True AudioX
VC-1 test bitstreamXX
WAVXX
WavPackX
WebMXX
Windows Televison (WTV)X
Wing Commander III movieXMultimedia format used in Origin’s Wing Commander III computer game.
Westwood Studios audioXMultimedia format used in Westwood Studios games.
Westwood Studios VQAXMultimedia format used in Westwood Studios games.
xWMAXMicrosoft audio container used by XAudio 2.
YUV4MPEG pipeXX
Psygnosis YOPX

X means that encoding (resp. decoding) is supported.

2.2 Image Formats

FFmpeg can read and write images for each frame of a video sequence. The following image formats are supported:

NameEncodingDecodingComments
.Y.U.VXXone raw file per component
animated GIFXXOnly uncompressed GIFs are generated.
BMPXXMicrosoft BMP image
DPXXXDigital Picture Exchange
JPEGXXProgressive JPEG is not supported.
JPEG 2000Edecoding supported through external library libopenjpeg
JPEG-LSXX
LJPEGXLossless JPEG
PAMXXPAM is a PNM extension with alpha support.
PBMXXPortable BitMap image
PCXXXPC Paintbrush
PGMXXPortable GrayMap image
PGMYUVXXPGM with U and V components in YUV 4:2:0
PICXPictor/PC Paint
PNGXX2/4 bpp not supported yet
PPMXXPortable PixelMap image
PTXXV.Flash PTX format
SGIXXSGI RGB image format
Sun RasterfileXSun RAS image format
TIFFXXYUV, JPEG and some extension is not supported yet.
Truevision TargaXXTarga (.TGA) image format

X means that encoding (resp. decoding) is supported.

E means that support is provided through an external library.

2.3 Video Codecs

NameEncodingDecodingComments
4X MovieXUsed in certain computer games.
8088flex TMVX
8SVX exponentialX
8SVX fibonacciX
A64 multicolorXCreates video suitable to be played on a commodore 64 (multicolor mode).
American Laser Games MMXUsed in games like Mad Dog McCree.
AMV VideoXUsed in Chinese MP3 players.
ANSI/ASCII artX
Apple MJPEG-BX
Apple QuickDrawXfourcc: qdrw
Asus v1XXfourcc: ASV1
Asus v2XXfourcc: ASV2
ATI VCR1Xfourcc: VCR1
ATI VCR2Xfourcc: VCR2
Auravision AuraX
Auravision Aura 2X
Autodesk Animator Flic videoX
Autodesk RLEXfourcc: AASC
AVS (Audio Video Standard) videoXVideo encoding used by the Creature Shock game.
Beam Software VBX
Bethesda VID videoXUsed in some games from Bethesda Softworks.
Bink VideoX
Bitmap Brothers JV videoX
Brute Force & IgnoranceXUsed in the game Flash Traffic: City of Angels.
C93 videoXCodec used in Cyberia game.
CamStudioXfourcc: CSCD
CD+GXVideo codec for CD+G karaoke disks
Chinese AVS videoEXAVS1-P2, JiZhun profile, encoding through external library libxavs
Delphine Software International CIN videoXCodec used in Delphine Software International games.
CinepakX
Cirrus Logic AccuPakXfourcc: CLJR
Creative YUV (CYUV)X
DFAXCodec used in Chronomaster game.
DiracEEsupported through external libdirac/libschroedinger libraries
Deluxe Paint AnimationX
DNxHDXXaka SMPTE VC3
Duck TrueMotion 1.0Xfourcc: DUCK
Duck TrueMotion 2.0Xfourcc: TM20
DV (Digital Video)XX
Feeble Files/ScummVM DXAXCodec originally used in Feeble Files game.
Electronic Arts CMV videoXUsed in NHL 95 game.
Electronic Arts Madcow videoX
Electronic Arts TGV videoX
Electronic Arts TGQ videoX
Electronic Arts TQI videoX
Escape 124X
FFmpeg video codec #1XXexperimental lossless codec (fourcc: FFV1)
Flash Screen Video v1XXfourcc: FSV1
Flash Screen Video v2X
Flash Video (FLV)XXSorenson H.263 used in Flash
FrapsX
H.261XX
H.263 / H.263-1996XX
H.263+ / H.263-1998 / H.263 version 2XX
H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10EXencoding supported through external library libx264
H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)EX
HuffYUVXX
HuffYUV FFmpeg variantXX
IBM UltimotionXfourcc: ULTI
id Cinematic videoXUsed in Quake II.
id RoQ videoXXUsed in Quake III, Jedi Knight 2, other computer games.
IFF ILBMXIFF interlaved bitmap
IFF ByteRun1XIFF run length encoded bitmap
Intel H.263X
Intel Indeo 2X
Intel Indeo 3X
Intel Indeo 5X
Interplay C93XUsed in the game Cyberia from Interplay.
Interplay MVE videoXUsed in Interplay .MVE files.
Karl Morton’s video codecXCodec used in Worms games.
Kega Game Video (KGV1)XKega emulator screen capture codec.
LagarithX
LCL (LossLess Codec Library) MSZHX
LCL (LossLess Codec Library) ZLIBEE
LOCOX
lossless MJPEGXX
Microsoft RLEX
Microsoft Video 1X
MimicXUsed in MSN Messenger Webcam streams.
Miro VideoXLXfourcc: VIXL
MJPEG (Motion JPEG)XX
Mobotix MxPEG videoX
Motion Pixels videoX
MPEG-1 videoXX
MPEG-1/2 video XvMC (X-Video Motion Compensation)X
MPEG-1/2 video (VDPAU acceleration)X
MPEG-2 videoXX
MPEG-4 part 2XX  libxvidcore can be used alternatively for encoding.
MPEG-4 part 2 Microsoft variant version 1X
MPEG-4 part 2 Microsoft variant version 2XX
MPEG-4 part 2 Microsoft variant version 3XX
Nintendo Gamecube THP videoX
NuppelVideo/RTjpegXVideo encoding used in NuppelVideo files.
On2 VP3Xstill experimental
On2 VP5Xfourcc: VP50
On2 VP6Xfourcc: VP60,VP61,VP62
VP8EXfourcc: VP80, encoding supported through external library libvpx
planar RGBXfourcc: 8BPS
Q-team QPEGXfourccs: QPEG, Q1.0, Q1.1
QuickTime 8BPS videoX
QuickTime Animation (RLE) videoXXfourcc: ’rle ’
QuickTime Graphics (SMC)Xfourcc: ’smc ’
QuickTime video (RPZA)Xfourcc: rpza
R10K AJA Kona 10-bit RGB CodecX
R210 Quicktime Uncompressed RGB 10-bitX
Raw VideoXX
RealVideo 1.0XX
RealVideo 2.0XX
RealVideo 3.0Xstill far from ideal
RealVideo 4.0X
Renderware TXD (TeXture Dictionary)XTexture dictionaries used by the Renderware Engine.
RL2 videoXused in some games by Entertainment Software Partners
Sierra VMD videoXUsed in Sierra VMD files.
Smacker videoXVideo encoding used in Smacker.
SMPTE VC-1X
SnowXXexperimental wavelet codec (fourcc: SNOW)
Sony PlayStation MDEC (Motion DECoder)X
Sorenson Vector Quantizer 1XXfourcc: SVQ1
Sorenson Vector Quantizer 3Xfourcc: SVQ3
Sunplus JPEG (SP5X)Xfourcc: SP5X
TechSmith Screen Capture CodecXfourcc: TSCC
TheoraEXencoding supported through external library libtheora
Tiertex Limited SEQ videoXCodec used in DOS CD-ROM FlashBack game.
V210 Quicktime Uncompressed 4:2:2 10-bitXX
VMware Screen Codec / VMware VideoXCodec used in videos captured by VMware.
Westwood Studios VQA (Vector Quantized Animation) videoX
Windows Media Video 7XX
Windows Media Video 8XX
Windows Media Video 9Xnot completely working
Wing Commander III / XanXUsed in Wing Commander III .MVE files.
Wing Commander IV / XanXUsed in Wing Commander IV.
Winnov WNV1X
WMV7XX
YAMAHA SMAFXX
Psygnosis YOP VideoX
ZLIBXXpart of LCL, encoder experimental
Zip Motion Blocks VideoXXEncoder works only in PAL8.

X means that encoding (resp. decoding) is supported.

E means that support is provided through an external library.

2.4 Audio Codecs

NameEncodingDecodingComments
8SVX audioX
AACEXencoding supported through external library libfaac and libvo-aacenc
AC-3IXX
ADPCM 4X MovieX
ADPCM CDROM XAX
ADPCM Creative TechnologyX16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
ADPCM Electronic ArtsXUsed in various EA titles.
ADPCM Electronic Arts Maxis CDROM XSXUsed in Sim City 3000.
ADPCM Electronic Arts R1X
ADPCM Electronic Arts R2X
ADPCM Electronic Arts R3X
ADPCM Electronic Arts XASX
ADPCM G.722XX
ADPCM G.726XX
ADPCM IMA AMVXUsed in AMV files
ADPCM IMA Electronic Arts EACSX
ADPCM IMA Electronic Arts SEADX
ADPCM IMA FuncomX
ADPCM IMA QuickTimeXX
ADPCM IMA Loki SDL MJPEGX
ADPCM IMA WAVXX
ADPCM IMA WestwoodX
ADPCM ISS IMAXUsed in FunCom games.
ADPCM IMA Duck DK3XUsed in some Sega Saturn console games.
ADPCM IMA Duck DK4XUsed in some Sega Saturn console games.
ADPCM MicrosoftXX
ADPCM MS IMAXX
ADPCM Nintendo Gamecube THPX
ADPCM QT IMAXX
ADPCM SEGA CRI ADXXXUsed in Sega Dreamcast games.
ADPCM Shockwave FlashXX
ADPCM SMJPEG IMAXUsed in certain Loki game ports.
ADPCM Sound Blaster Pro 2-bitX
ADPCM Sound Blaster Pro 2.6-bitX
ADPCM Sound Blaster Pro 4-bitX
ADPCM Westwood Studios IMAXUsed in Westwood Studios games like Command and Conquer.
ADPCM YamahaXX
AMR-NBEXencoding supported through external library libopencore-amrnb
AMR-WBEXencoding supported through external library libvo-amrwbenc
Apple lossless audioXXQuickTime fourcc ’alac’
Atrac 1X
Atrac 3X
Bink AudioXUsed in Bink and Smacker files in many games.
CELT (Opus)Edecoding supported through external library libcelt
Delphine Software International CIN audioXCodec used in Delphine Software International games.
COOKXAll versions except 5.1 are supported.
DCA (DTS Coherent Acoustics)XX
DPCM id RoQXXUsed in Quake III, Jedi Knight 2, other computer games.
DPCM InterplayXUsed in various Interplay computer games.
DPCM Sierra OnlineXUsed in Sierra Online game audio files.
DPCM SolX
DPCM XanXUsed in Origin’s Wing Commander IV AVI files.
DSP Group TrueSpeechX
DV audioX
Enhanced AC-3X
FLAC (Free Lossless Audio Codec)XIX
GSMEXencoding supported through external library libgsm
GSM Microsoft variantEXencoding supported through external library libgsm
IMC (Intel Music Coder)X
MACE (Macintosh Audio Compression/Expansion) 3:1X
MACE (Macintosh Audio Compression/Expansion) 6:1X
MLP (Meridian Lossless Packing)XUsed in DVD-Audio discs.
Monkey’s AudioXOnly versions 3.97-3.99 are supported.
MP1 (MPEG audio layer 1)IX
MP2 (MPEG audio layer 2)IXIX
MP3 (MPEG audio layer 3)EIXencoding supported through external library LAME, ADU MP3 and MP3onMP4 also supported
MPEG-4 Audio Lossless Coding (ALS)X
Musepack SV7X
Musepack SV8X
Nellymoser AsaoXX
PCM A-lawXX
PCM mu-lawXX
PCM 16-bit little-endian planarX
PCM 32-bit floating point big-endianXX
PCM 32-bit floating point little-endianXX
PCM 64-bit floating point big-endianXX
PCM 64-bit floating point little-endianXX
PCM D-Cinema audio signed 24-bitXX
PCM signed 8-bitXX
PCM signed 16-bit big-endianXX
PCM signed 16-bit little-endianXX
PCM signed 24-bit big-endianXX
PCM signed 24-bit little-endianXX
PCM signed 32-bit big-endianXX
PCM signed 32-bit little-endianXX
PCM signed 16/20/24-bit big-endian in MPEG-TSX
PCM unsigned 8-bitXX
PCM unsigned 16-bit big-endianXX
PCM unsigned 16-bit little-endianXX
PCM unsigned 24-bit big-endianXX
PCM unsigned 24-bit little-endianXX
PCM unsigned 32-bit big-endianXX
PCM unsigned 32-bit little-endianXX
PCM ZorkXX
QCELP / PureVoiceX
QDesign Music Codec 2XThere are still some distortions.
RealAudio 1.0 (14.4K)XXReal 14400 bit/s codec
RealAudio 2.0 (28.8K)XReal 28800 bit/s codec
RealAudio 3.0 (dnet)IXXReal low bitrate AC-3 codec
RealAudio SIPR / ACELP.NETX
ShortenX
Sierra VMD audioXUsed in Sierra VMD files.
Smacker audioX
SMPTE 302M AES3 audioX
SonicXXexperimental codec
Sonic losslessXXexperimental codec
SpeexEsupported through external library libspeex
True Audio (TTA)X
TrueHDXUsed in HD-DVD and Blu-Ray discs.
TwinVQ (VQF flavor)X
VorbisEXA native but very primitive encoder exists.
WavPackX
Westwood Audio (SND1)X
Windows Media Audio 1XX
Windows Media Audio 2XX
Windows Media Audio ProX
Windows Media Audio VoiceX

X means that encoding (resp. decoding) is supported.

E means that support is provided through an external library.

I means that an integer-only version is available, too (ensures high performance on systems without hardware floating point support).

2.5 Subtitle Formats

NameMuxingDemuxingEncodingDecoding
SSA/ASSXXXX
DVBXXXX
DVDXXXX
MicroDVDXX
PGSX
SubRip (SRT)XXXX
XSUBXX

X means that the feature is supported.

2.6 Network Protocols

NameSupport
Apple HTTP Live StreamingX
fileX
GopherX
HTTPX
MMSX
pipeX
RTPX
TCPX
UDPX

X means that the protocol is supported.

2.7 Input/Output Devices

NameInputOutput
ALSAXX
BKTRX
DV1394X
JACKX
LIBDC1394X
OSSXX
Video4LinuxX
Video4Linux2X
VfW captureX
X11 grabbingX

X means that input/output is supported.

3. Platform Specific information

3.1 DOS

Using a cross-compiler is preferred for various reasons.

3.1.1 DJGPP

FFmpeg cannot be compiled because of broken system headers, add --extra-cflags=-U__STRICT_ANSI__ to the configure options as a workaround.

3.2 OS/2

For information about compiling FFmpeg on OS/2 see http://www.edm2.com/index.php/FFmpeg.

3.3 Unix-like

Some parts of FFmpeg cannot be built with version 2.15 of the GNU assembler which is still provided by a few AMD64 distributions. To make sure your compiler really uses the required version of gas after a binutils upgrade, run:

 
$(gcc -print-prog-name=as) --version

If not, then you should install a different compiler that has no hard-coded path to gas. In the worst case pass --disable-asm to configure.

3.3.1 BSD

BSD make will not build FFmpeg, you need to install and use GNU Make (‘gmake’).

3.3.2 (Open)Solaris

GNU Make is required to build FFmpeg, so you have to invoke (‘gmake’), standard Solaris Make will not work. When building with a non-c99 front-end (gcc, generic suncc) add either --extra-libs=/usr/lib/values-xpg6.o or --extra-libs=/usr/lib/64/values-xpg6.o to the configure options since the libc is not c99-compliant by default. The probes performed by configure may raise an exception leading to the death of configure itself due to a bug in the system shell. Simply invoke a different shell such as bash directly to work around this:

 
bash ./configure

3.3.3 Darwin (MacOS X, iPhone)

MacOS X on PowerPC or ARM (iPhone) requires a preprocessor from http://github.com/yuvi/gas-preprocessor to build the optimized assembler functions. Just download the Perl script and put it somewhere in your PATH, FFmpeg’s configure will pick it up automatically.

3.4 Windows

To get help and instructions for building FFmpeg under Windows, check out the FFmpeg Windows Help Forum at http://ffmpeg.arrozcru.org/.

3.4.1 Native Windows compilation

FFmpeg can be built to run natively on Windows using the MinGW tools. Install the latest versions of MSYS and MinGW from http://www.mingw.org/. You can find detailed installation instructions in the download section and the FAQ.

FFmpeg does not build out-of-the-box with the packages the automated MinGW installer provides. It also requires coreutils to be installed and many other packages updated to the latest version. The minimum version for some packages are listed below:

FFmpeg automatically passes -fno-common to the compiler to work around a GCC bug (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216).

Within the MSYS shell, configure and make with:

 
./configure --enable-memalign-hack
make
make install

This will install ‘ffmpeg.exe’ along with many other development files to ‘/usr/local’. You may specify another install path using the --prefix option in ‘configure’.

Notes:

3.4.2 Microsoft Visual C++ compatibility

As stated in the FAQ, FFmpeg will not compile under MSVC++. However, if you want to use the libav* libraries in your own applications, you can still compile those applications using MSVC++. But the libav* libraries you link to must be built with MinGW. However, you will not be able to debug inside the libav* libraries, since MSVC++ does not recognize the debug symbols generated by GCC. We strongly recommend you to move over from MSVC++ to MinGW tools.

This description of how to use the FFmpeg libraries with MSVC++ is based on Microsoft Visual C++ 2005 Express Edition. If you have a different version, you might have to modify the procedures slightly.

3.4.2.1 Using static libraries

Assuming you have just built and installed FFmpeg in ‘/usr/local’.

  1. Create a new console application ("File / New / Project") and then select "Win32 Console Application". On the appropriate page of the Application Wizard, uncheck the "Precompiled headers" option.
  2. Write the source code for your application, or, for testing, just copy the code from an existing sample application into the source file that MSVC++ has already created for you. For example, you can copy ‘libavformat/output-example.c’ from the FFmpeg distribution.
  3. Open the "Project / Properties" dialog box. In the "Configuration" combo box, select "All Configurations" so that the changes you make will affect both debug and release builds. In the tree view on the left hand side, select "C/C++ / General", then edit the "Additional Include Directories" setting to contain the path where the FFmpeg includes were installed (i.e. ‘c:\msys\1.0\local\include’). Do not add MinGW’s include directory here, or the include files will conflict with MSVC’s.
  4. Still in the "Project / Properties" dialog box, select "Linker / General" from the tree view and edit the "Additional Library Directories" setting to contain the ‘lib’ directory where FFmpeg was installed (i.e. ‘c:\msys\1.0\local\lib’), the directory where MinGW libs are installed (i.e. ‘c:\mingw\lib’), and the directory where MinGW’s GCC libs are installed (i.e. ‘C:\mingw\lib\gcc\mingw32\4.2.1-sjlj’). Then select "Linker / Input" from the tree view, and add the files ‘libavformat.a’, ‘libavcodec.a’, ‘libavutil.a’, ‘libmingwex.a’, ‘libgcc.a’, and any other libraries you used (i.e. ‘libz.a’) to the end of "Additional Dependencies".
  5. Now, select "C/C++ / Code Generation" from the tree view. Select "Debug" in the "Configuration" combo box. Make sure that "Runtime Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in the "Configuration" combo box and make sure that "Runtime Library" is set to "Multi-threaded DLL".
  6. Click "OK" to close the "Project / Properties" dialog box.
  7. MSVC++ lacks some C99 header files that are fundamental for FFmpeg. Get msinttypes from http://code.google.com/p/msinttypes/downloads/list and install it in MSVC++’s include directory (i.e. ‘C:\Program Files\Microsoft Visual Studio 8\VC\include’).
  8. MSVC++ also does not understand the inline keyword used by FFmpeg, so you must add this line before #includeing libav*:
     
    #define inline _inline
    
  9. Build your application, everything should work.

3.4.2.2 Using shared libraries

This is how to create DLL and LIB files that are compatible with MSVC++:

  1. Add a call to ‘vcvars32.bat’ (which sets up the environment variables for the Visual C++ tools) as the first line of ‘msys.bat’. The standard location for ‘vcvars32.bat’ is ‘C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat’, and the standard location for ‘msys.bat’ is ‘C:\msys\1.0\msys.bat’. If this corresponds to your setup, add the following line as the first line of ‘msys.bat’:
     
    call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
    

    Alternatively, you may start the ‘Visual Studio 2005 Command Prompt’, and run ‘c:\msys\1.0\msys.bat’ from there.

  2. Within the MSYS shell, run lib.exe. If you get a help message from ‘Microsoft (R) Library Manager’, this means your environment variables are set up correctly, the ‘Microsoft (R) Library Manager’ is on the path and will be used by FFmpeg to create MSVC++-compatible import libraries.
  3. Build FFmpeg with
     
    ./configure --enable-shared --enable-memalign-hack
    make
    make install
    

    Your install path (‘/usr/local/’ by default) should now have the necessary DLL and LIB files under the ‘bin’ directory.

To use those files with MSVC++, do the same as you would do with the static libraries, as described above. But in Step 4, you should only need to add the directory where the LIB files are installed (i.e. ‘c:\msys\usr\local\bin’). This is not a typo, the LIB files are installed in the ‘bin’ directory. And instead of adding the static libraries (‘libxxx.a’ files) you should add the MSVC import libraries (‘avcodec.lib’, ‘avformat.lib’, and ‘avutil.lib’). Note that you should not use the GCC import libraries (‘libxxx.dll.a’ files), as these will give you undefined reference errors. There should be no need for ‘libmingwex.a’, ‘libgcc.a’, and ‘wsock32.lib’, nor any other external library statically linked into the DLLs. The ‘bin’ directory contains a bunch of DLL files, but the ones that are actually used to run your application are the ones with a major version number in their filenames (i.e. ‘avcodec-51.dll’).

FFmpeg headers do not declare global data for Windows DLLs through the usual dllexport/dllimport interface. Such data will be exported properly while building, but to use them in your MSVC++ code you will have to edit the appropriate headers and mark the data as dllimport. For example, in libavutil/pixdesc.h you should have:

 
extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];

Note that using import libraries created by dlltool requires the linker optimization option to be set to "References: Keep Unreferenced Data (/OPT:NOREF)", otherwise the resulting binaries will fail during runtime. This isn’t required when using import libraries generated by lib.exe.

3.4.3 Cross compilation for Windows with Linux

You must use the MinGW cross compilation tools available at http://www.mingw.org/.

Then configure FFmpeg with the following options:

 
./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-

(you can change the cross-prefix according to the prefix chosen for the MinGW tools).

Then you can easily test FFmpeg with Wine (http://www.winehq.com/).

3.4.4 Compilation under Cygwin

Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack llrint() in its C library.

Install your Cygwin with all the "Base" packages, plus the following "Devel" ones:

 
binutils, gcc4-core, make, git, mingw-runtime, texi2html

And the following "Utils" one:

 
diffutils

Then run

 
./configure --enable-static --disable-shared

to make a static build.

The current gcc4-core package is buggy and needs this flag to build shared libraries:

 
./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions

If you want to build FFmpeg with additional libraries, download Cygwin "Devel" packages for Ogg and Vorbis from any Cygwin packages repository:

 
libogg-devel, libvorbis-devel

These library packages are only available from Cygwin Ports (http://sourceware.org/cygwinports/) :

 
yasm, libSDL-devel, libdirac-devel, libfaac-devel, libgsm-devel,
libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel,
libxvidcore-devel

The recommendation for libnut and x264 is to build them from source by yourself, as they evolve too quickly for Cygwin Ports to be up to date.

Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means of the libgetaddrinfo-devel package, available at Cygwin Ports.

3.4.5 Crosscompilation for Windows under Cygwin

With Cygwin you can create Windows binaries that do not need the cygwin1.dll.

Just install your Cygwin as explained before, plus these additional "Devel" packages:

 
gcc-mingw-core, mingw-runtime, mingw-zlib

and add some special flags to your configure invocation.

For a static build run

 
./configure --target-os=mingw32 --enable-memalign-hack --enable-static --disable-shared --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin

and for a build with shared libraries

 
./configure --target-os=mingw32 --enable-memalign-hack --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin

This document was generated by Kyle Schwarz on May 18, 2011 using texi2html 1.82.