Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Using FFMpeg in Microsoft Visual C++ Environment

0.00/5 (No votes)
28 Jan 2007 1  
Integrate ffmpeg library into your visual C++ project.

Sample Image - ffmpeglogo.jpg

Introduction

FFMpeg is a free video library that can record and convert audio and video data. FFMpeg is under GNU Lesser General Public License, but FFMpeg also uses some third part library which maybe under GNU General Public License. So before using FFMpeg library, you'd better spend some time on the license.

FFMpeg includes the following librarys

  • libavcodec: All of the video and audio encoders and decoders.
  • libavformat: Demuxers and muxers for audio and video formats.
  • libavutil: Useful utils of FFMpeg
  • Get FFMpeg Source Code

    There are no formal release of FFMpeg, however, you can get FFMpeg source code on a daily basic.

    svn://svn.mplayerhq.hu/ffmpeg/trunk
    
    

    For example, you can checkout source code using TortoiseSVN,

    Checkout FFMpeg Source Code

    Compiling FFMpeg

    FFmpeg is developed under Linux, but it can be compiled under most operating systems.

    For Windows, FFMpeg can be compilied by MSYS and MingGW. If you had setup MSYS and MingGW system correctly, you can compile FFMpeg under it's folder.

    1. Cleanup former build results.

    make distclean
    

    2. Setup build parameters.

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

    If there are no errors, and config.mak and config.h generated, you can build the library, and then, if you want, you can install them into MSYS environment.

    make
    make install
    

    Using FFMpeg in Your Visual C++ Environment

    1. Create inttypes.h and stdint.h if you don't have them. Attachment is a copy of these two files. You can get them from other place if you want.

    2. Setting up Additional Include Directories and Additional Library Directories. By default, these folder is under your MSYS folder, for example:

    /usr/local/include
    /usr/local/lib
    

    3. Add FFmpeg's shared libraries, include libavutil.lib libavcodec.lib libavformat.lib:

    4. Include the FFMpeg header,

    #include <ffmpeg/avformat.h>
    
    #include <ffmpeg/avcodec.h>
    
    

    Using the FFMpeg code

    There are an example within FFMpeg, output_example.c. But if you copied codes from this example, following tips may ensure you compiles successfully.

    1. Add required casts.

    2. Change snprintf to _snprintf

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here