| Last Modified On : | October 1, 2009 3:39 AM PDT |
Rate |
|
The application ‘ffmpeg’ consist of three executables and 5 libraries. All the sources can be downloaded using the following svn command:
Ø svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
Required patch
One version which I tried ( download: svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg –r 17944)
has a known problem with the sources. If you try to build the code, then you will get a compile time error:
libswscale/swscale.c:488: error: ‘PIX_FMT_YUV420PLE’ undeclared
The solution is solved by copying the contents of the libswscale directory from . http://www.ffmpeg.org/releases/ffmpeg-0.5.tar.bz2 (see http://www.ffmpeg.org/download.html)
Please Note, only the libswscale directory should be copied over the top of the existing files.
Following instructions will help you build ffmpeg under a Linux system assuming that the tar ball from the download is copied to <install_directory>:
Ø cd <install_directory>
Ø cd tar xvfz ffmpeg.tar.gz #Extract the tar ball to your local directory. You will find a directory tree under the name ffmpeg installed. All the required sources are installed within this tree provided that you are not enabling any additional third party libraries.
Ø cd ffmpeg
Ø ./configure –help <cr> # to show all the options available to rebuild ffmpeg. For a reference build with gcc there is no need to provide any parameters to configure. However if you would like to enable any third party libraries like ‘libfaad’, ‘libx264’ etc. then you need to add --enable-libfaad --enable-libx264 etc. as parameters to configure. If this is required make sure that you have these sources available on your development environment and that the third party libraries are rebuilt with the selected compiler / compiler options.
Ø ./configure <parameters as below>
Ø make <cr> #recommended sequence is ‘make clean’ followed by ‘make’. The rebuild will take several minutes (depending on your development environment). Two versions of each executable are produced: ex. ‘ffmpeg’ and ‘ffmpeg_g’. The ‘*_g’ contains the executable with debug information while the ‘*’ is the stripped version. In addition ‘ffplay, ffplay_g, ffserver and ffserver_g’ are produced as executables and libavutil, libavcodec, libavformat, libavdevice and libswscale are rebuilt.
Icc build:
Depending on what version of icc you are using different configure parameters may be necessary.
Using icc v10.1.xxx:
Ø ./configure cc=icc --extra-cflags=”-xL –O3” --extra-libs=-lsvml <cr> # Without linking in the extra library (libsvml.so) you get several references unresolved.
Using icc v11.0.xxx:
Ø ./configure cc=icc –extra-cflags=”-xSSE3_ATOM –O3” –extra-libs=-lsvml <cr> # The option –xSSE3_ATOM do require that you run the code on a processor which does support the ‘movbe’ instruction. If you would like to test the code on a processor not supporting the ‘movbe’ instruction you can add the option ‘-minstruction=nomovbe’ in the extra-cflag part of the command line above.
Ø Make sure that the LD (linker) options do not contain ‘–march=generic’ in the config.mak file. This option causes an error from the compiler.
Using icc v11.1.xxx:
Ø To avoid a run time erratum following source change is needed: Open file ./libavcodec/x86/dsputil_mmx.c and on line #2944 insert // before || __ICC > 1100. The line is highlighted below.
Ø After the change it will look like: #if ARCH_X86_64 || ! ( __ICC) // || __ICC > 1100
Ø ./configure cc=icc –extra-cflags=”-xSSE3_ATOM –O3” <cr> # This simple configure does work but you get better performance if you also add the ‘--extra-lib=-lsvml’. Additional compiler switches can be used to improve the performance – for example ‘-no-prec-div’, ‘-vec-‘. As the no-prec-div has an effect on the fp calculations please refer to the compiler documentation before it is used. In addition the ‘-xSSE3_ATOM’ switch are no longer requiring a processor with ‘movbe’ support.
Cross compilation.
It is standard practice to build the library and executables on a development machine and then copy the resultant files to the MOBLIN target. You can use the option --enable–cross-compile in this case.
Once you have completed the configure stage you can just run the ‘make clean’ followed by ‘make’. You could expect additional warnings produced.
Building ffmpeg with third party libraries:
The application can support 21 different external 3rd party libraries. Each of those are selected in the configure process by adding the option ‘--enable-<library-name>’.
Below is an example of using some of the different external libraries available:
Ø ./configure <other options as above> --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid
The invocation above assumes that you will be using 6 external 3rd party libraries:
- libfaac # for example you can download ‘faac-1.28.tar.gz’ or later version from the web.
- libfaad # for example you can download ‘faad2-2.7.tar.gz’ or later version from the web.
- libmp3lame # for example you can download ‘lame-398-2.tar.gz’ or later version from the web.
- libtheora # for example you can download ‘libtheora-1.0.tar.tar’ or later version from the web. Please note that you can not use ICC v 10.1 to rebuild this library due to a compiler issue. This has been fixed with 11.1 version of the compiler.
- libx264 # for example you can download ‘x264-snapshot-20090117-2245.tar.bz2’ or later version from the web.
- libxvid # for example you can download ‘xvidcore-1.2.1.tar.gz’ or later version from the web.
