From EDM2
Jump to: navigation, search

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 or libav

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.


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
+    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 you need an *nix build setup. Currently only GCC3.3.5 and newer is supported for building. GCC 4.4.6 works the best. A complete build environment is available at http://os2ports.smedley.id.au/index.php?page=BuildEnvDVD.

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. As the NASM project has stopped building OS/2 binaries, you can compile it yourself using either GCC with the auto tools or OpenWatcom. I'll also try to keep uploading recent versions to Hobbes.

You also need SDL setup correctly to build AVPlay or 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 missing symbol errors at the end of the compile.

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.

It is also advised to use a separate object directory.

First step should be to do

sh path_to_repository/configure --help

to see all available options.

Using --enable-gpl will allow the most features to be used whereas not using --enable-gpl will allow you to use the resulting libraries in projects that are not GPL compatible. Read the license if distributing or using in another project.

Hint, by using a cmd prompt in an EPM window you can get a scrollable window.

Basic lgpl licensed FFmpeg can be compiled as

sh path_to_repository/configure


sh configure --enable-shared --disable-static 



At this point

make install

Will install FFmpeg in /usr/local. You can pass prefix to configure to change the install location eg

sh path_to_repository/configure --enable-shared --disable-static --prefix=x:/ffmpeg 

After building you may want to run lxlite on the resulting binaries and/or DLLs.


Your 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 libav you can visit http://fate.libav.org. There is also http://fate.ffmpeg.org Info on setting up the fate environment is in the doc subdirectory as fate.txt.

Various Hints

Various libraries that can be used by FFmpeg are available at Hobbes, [5]