FFmpeg: Difference between revisions
Line 50: | Line 50: | ||
If you would like to build a build environment from scratch http://developer.mozilla.org/en/docs/OS/2_Build_Prerequisites has links to many ported packages. | If you would like to build a build environment from scratch http://developer.mozilla.org/en/docs/OS/2_Build_Prerequisites has links to many ported packages. | ||
For the assembly files you need NASM installed. Currently NASM has to be a very recent version, best to download the latest daily at nasm.us [http://www.nasm.us/pub/nasm/snapshots/latest/os2/] | |||
You also need SDL setup correctly to build FFplay, see http://www.edm2.com/index.php/SDL. | You also need SDL setup correctly to build FFplay, see http://www.edm2.com/index.php/SDL. |
Revision as of 04:14, 27 May 2011
Which ffmpeg fork
Currently there are two forks of ffmpeg, FFmpeg [1] led by Michael Niedermayer is the original project. Libav [2] is a recent fork of many of the active developers who were unhappy with Michael's leadership.
Both are quite active with interesting patches finding their way from one project to the other. Libav seems to have been adopted by the majority of Linux distributions and has also been OS/2 friendly, not that FFmpeg has not been.
Most everything below applies to either project as they are mostly still interchangeable.
Getting FFmpeg
Both projects are now using git [3] for version control. There is an OS/2 port available at [4]. Be sure to follow the installation instructions closely. I also had to remove my set PAGER=less.exe from config.sys before it worked for me.
Initial checkout is done with the git clone command.
For libav, git clone git://git.libav.org/libav.git
For FFmpeg, git clone git://git.videolan.org/ffmpeg.git
Both of which will create a directory below where you entered the command. At this point you can update the tree by CDing into the projects root directory and issuing the command git pull.
There are lots of git tutorials on the web including a short introduction in your newly cloned tree under doc\git-howto.txt.
Patching FFmpeg
To build the documentation you may need to apply this patch depending on which version of Perl you have installed and where it is installed.
Index: doc/texi2pod.pl =================================================================== --- doc/texi2pod.pl (revision 10843) +++ doc/texi2pod.pl (working copy) @@ -1,4 +1,6 @@ -#! /usr/bin/perl -w +#!perl + eval 'exec perl -wS $0 ${1+"$@"}' + if 0; # Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copy and paste the above patch into a file called os2.patch and in the ffmpeg or libav directory enter the command
patch -p0 < os2.patch.
Warning Make sure that you have gnu patch in your path ahead of the OS/2 patch.exe in x:\os2. There is a version of gnu patch available at http://hobbes.nmsu.edu/pub/os2/dev/util/gnupatch.zip
Hints on Setting up the Environment
To build FFmpeg you need an unix build setup. Currently only GCC3.3.5 and newer is supported for building. The newer the version of GCC the better, current version is 4.5.2 which ships with eCS 2.1. A complete build environment is available at http://www.smedley.info/os2ports/index.php?page=build-environment.
If you would like to build a build environment from scratch http://developer.mozilla.org/en/docs/OS/2_Build_Prerequisites has links to many ported packages.
For the assembly files you need NASM installed. Currently NASM has to be a very recent version, best to download the latest daily at nasm.us [5]
You also need SDL setup correctly to build FFplay, see http://www.edm2.com/index.php/SDL.
Configure needs a Posix shell, I recommend pdksh, http://hobbes.nmsu.edu/pub/os2/util/shell/pdksh-5.2.14-bin-2.zip Ash will also work if %PWD% is first set, eg
set PWD=x:/path/to/repositry
Note uses slashes instead of backslashes. Failure to set PWD when using ash will result in hard to trace errors when running make.
It is recommended to have pthreads installed. A version is available at http://web.os2power.com/yuri/PthreadTls.
Compiling FFmpeg
Before compiling you have to decide whether to build with shared libs or static libs. For standalone use I'd advise static libs as the simpler solution. For using in other projects shared libs do have advantages, both in ease of maintenance and for licensing issues. First step should be to do
sh configure --help
to see all available options. Hint, by using a cmd prompt in an EPM window you can get a scrollable window. Currently due to our headers being somewhat broken from a Posix viewpoint we need to add -D_GNU_SOURCE to the CFLAGS like below. Also as YASM does not produce OS/2 object files we need to disable YASM. Basic lgpl licensed FFmpeg can be compiled as
sh configure --enable-static --disable-shared --extra-cflags="-D_GNU_SOURCE" --disable-yasm
or
sh configure --enable-shared --disable-static --extra-cflags="-D_GNU_SOURCE" --disable-yasm
then
make
At this point
make install
Will should FFmpeg in /usr/local. You can pass prefix to configure to change the install location eg
sh configure --enable-shared --disable-static --prefix=x:/ffmpeg --extra-cflags="-D_GNU_SOURCE" --disable-yasm
A more useful FFmpeg which is licensed GPL can be built by adding these arguments to the above configure command
--enable-gpl --enable-postproc --enable-avfilter --enable-avfilter-lavf --disable-debug
with all options as one line.
Note that if lxlite outputs a help screen the problem is not having a driveletter in the prefix and lxlite taking the pathname as a command due to the leading slash. In this case you have to pass a prefix with a driveletter to configure.
Testing FFmpeg
Your FFmpeg build can be tested by running
make test
If building with shared libraries of course you will need to set BEGINLIBPATH or move the DLLs to your LIBPATH. Usually moving them to the same directory as the FFmpeg binary is located will work.
Currently all tests pass if using a fairly new GCC.
If you are curious how various platforms, including OS/2, do with FFmpeg you can visit http://fate.ffmpeg.org. Info on setting up the fate environment is at http://wiki.multimedia.cx/index.php?title=Running_FATE
Various Hints
Various libraries that can be used by FFmpeg are available at Hobbes, [6]