Using FFMpeg in Microsoft Visual C++ Environment

來源:互聯網
上載者:User
Using FFMpeg in Microsoft Visual C++ EnvironmentBy Denny50

|
28 Jan 2007
| Unedited contribution

Integrate ffmpeg library into your visual C++ project.

  • Required Header Files - 5 Kb

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,

    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

    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.

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.