现在的位置: 首页 > 综合 > 正文

Using FFMpeg in Microsoft Visual C++ Environment

2013年08月24日 ⁄ 综合 ⁄ 共 2563字 ⁄ 字号 评论关闭

Using FFMpeg in Microsoft Visual C++ Environment

By Denny50

|
28 Jan 2007
| Unedited contribution

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.

    Collapse
    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.

    Collapse
    make distclean

    2. Setup build parameters.

    Collapse
    ./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.

    Collapse
    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:

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

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

    4. Include the FFMpeg header,

    Collapse
    #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

    About the Author

    Denny50

    Software Developer (Senior)

    Australia
    Australia

    Member

    Senior software engineer with 10 years experience of C/C++ programming.
    Now also has some project with C#. I'm from Shanghai and now working at
    Melbourne. At I spare time, I enjoy my family life. My blog, Childhood
    is a collection about my family, epically my lovely son. Most of them
    write in Chinese, and a few in my poor English - please forgive me, I'm
    improving my English as soon as I can.

    抱歉!评论已关闭.