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 party 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 libraries:

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 releases of FFMpeg; however, you can get the FFMpeg source code on a daily basis.

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

For example, you can checkout the 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 compiled with MSYS and MingGW. If you have setup MSYS and MingGW systems correctly, you can compile FFMpeg under its folder.

Cleanup former build results.

make distclean

Setup build parameters.

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

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

make
make install

Using FFMpeg in Your Visual C++ Environment

Create inttypes.h and stdint.h if you don't have them. Provided in the above link is a copy of these two files. You can get them from another place if you want.

Set up additional include directories and additional library directories. By default, these folders are under your MSYS folder, for example:

Thank you very much for this useful tutorial.I have done all steps, and it built successfully. But when I run the example, it show exception:"The procedure entry point url_fclose could not be located in the dynamic link library avcodec-52.dll"

I don't understand this error, because url_fclose is defined in libavformat/avio.h, not libavcodec include folder.Does anybody have any idea about this?I use Visual C++ 2005 Express Edition, ffmpeg 0.6.1. This exception also takes place when I use Visual Studio 2008.Thank you in advance!

then right click my computer - properties - advanced - environment variables --- append the above 2 strings to the variable named "Path".then you probably have to restart mingw. then run make clean from inside mingw.then make. then rebuild your project with the new dll and .lib files.then note that the lib files you were using probably had names like libavcodec.lib, libavdevice.lib, etc and the new ones have names like avcodec-53.lib, avdevice-53.lib, etc.then smile. and eat a snickers. not too many though. you fatty. and give me one.

Hi,I need help in encoding video/audio. Also can you suggest me the components in ffmpeg which would be helpful in encoding process. I'm completely newbie to media encoding and less familiar with ffmpeg.

well my friend, it is all about the ./configure command where you have to specify the type of output you want to be generated. For a full list of possible options type ./configure --help, and I think you will find some options like --enable static or something like that. I hope this can help

/* * This Code Was Created By Jeff Molofee 2000 * A HUGE Thanks To Fredric Echols For Cleaning Up * And Optimizing The Base Code, Making It More Flexible! * If You've Found This Code Useful, Please Let Me Know. * Visit My Site At nehe.gamedev.net */

int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing{ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The View glTranslatef(0.0f,0.0f,-5.0f);

GLvoid KillGLWindow(GLvoid) // Properly Kill The Window{ if (fullscreen) // Are We In Fullscreen Mode? { ChangeDisplaySettings(NULL,0); // If So Switch Back To The Desktop ShowCursor(TRUE); // Show Mouse Pointer }

if (hRC) // Do We Have A Rendering Context? { if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts? { MessageBox(NULL,TEXT("Release Of DC And RC Failed."),TEXT("SHUTDOWN ERROR"),MB_OK | MB_ICONINFORMATION); }

if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC? { MessageBox(NULL,TEXT("Release Rendering Context Failed."),TEXT("SHUTDOWN ERROR"),MB_OK | MB_ICONINFORMATION); } hRC=NULL; // Set RC To NULL }

if (hWnd && !DestroyWindow(hWnd)) // Are We Able To Destroy The Window? { MessageBox(NULL,TEXT("Could Not Release hWnd."),TEXT("SHUTDOWN ERROR"),MB_OK | MB_ICONINFORMATION); hWnd=NULL; // Set hWnd To NULL }

if (!UnregisterClass(TEXT("OpenGL"),hInstance)) // Are We Able To Unregister Class { MessageBox(NULL,TEXT("Could Not Unregister Class."),TEXT("SHUTDOWN ERROR"),MB_OK | MB_ICONINFORMATION); hInstance=NULL; // Set hInstance To NULL }}

/* This Code Creates Our OpenGL Window. Parameters Are: * * title - Title To Appear At The Top Of The Window * * width - Width Of The GL Window Or Fullscreen Mode * * height - Height Of The GL Window Or Fullscreen Mode * * bits - Number Of Bits To Use For Color (8/16/24/32) * * fullscreenflag - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE) */

if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Are We Able To Set The Pixel Format? { KillGLWindow(); // Reset The Display MessageBox(NULL,TEXT("Can't Set The PixelFormat."),TEXT("ERROR"),MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE }

if (!(hRC=wglCreateContext(hDC))) // Are We Able To Get A Rendering Context? { KillGLWindow(); // Reset The Display MessageBox(NULL,TEXT("Can't Create A GL Rendering Context."),TEXT("ERROR"),MB_OK|MB_ICONEXCLAMATION); return FALSE; // Return FALSE }

// Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,TEXT("Would You Like To Run In Fullscreen Mode?"), TEXT("Start FullScreen?"),MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode }

I am first time using ffmpeg library.I have one http site which have live music like FM.But the music file in .wma format and my media player just support .mp3 format. So I am not able to play .wma file.So i need to convert .wma format data to mp3 format, on the fly.Please suggest,How can I convert it ? and which API is useful for this process?or suggest any example...

After fighting with the Windows command shell and an old version of cygwin, I found that you really need (in addition to MinGW) either:- a recent version of Cygwinor- Msys and MinGW installed.

I was finally able to configure and compile ffmpeg in Windows XP using the Msys shell and doing the following:download ffmpeg-0.5download and install MinGW and Msys (follow install instructions on mingw website)(I used their installer for MinGW which installed the latest version. I used MSYS-1.0.10.exe)

download and extract the latest bash, make, and coreutils:http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963(I used bash-3.1-MSYS-1.0.11-1.tar.bz2, coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 and make-3.81-MSYS-1.0.11-2.tar.bz2)

download and extract the latest w32api:http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11550(I used w32api-3.13-mingw32-dev.tar.gz)

After fighting with the Windows command shell and an old version of cygwin, I found that you really need (in addition to MinGW) either:- a recent version of Cygwinor- Msys and MinGW installed.

I was finally able to configure and compile ffmpeg in Windows XP using the Msys shell and doing the following:download ffmpeg-0.5download and install MinGW and Msys (follow install instructions on mingw website)(I used their installer for MinGW which installed the latest version. I used MSYS-1.0.10.exe)

download and extract the latest bash, make, and coreutils:http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963(I used bash-3.1-MSYS-1.0.11-1.tar.bz2, coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 and make-3.81-MSYS-1.0.11-2.tar.bz2)

download and extract the latest w32api:http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11550(I used w32api-3.13-mingw32-dev.tar.gz)

hi denny,i want to ask that, i'm aiming in writing C code to open a video file to run some motion detection algorithm on it.The C code will be written in Linux environment,Ubuntu. So izzit this project will allow me to decode the video file to a frame by frame so that i can run my motion detection on each frame?

I want to use ffmpeg library to convert my data(could be anythng simply camera picture or char *) to flv for live streaming. So i would like to know how could i include ffmpeg library into my application.

when I include avformat.h, the compiler generates an error in line 66 of avformat.h file with the message "integer constant is too large for long type". The code is as below: pkt->pts = AV_NOPTS_VALUE;Moreover, there's another error message with this line which is "INT64_C undeclared (first use this function)"