Jump to content

FFmpeg

From EDM2

Getting FFmpeg

The best way to get FFmpeg sources is with SVN. Paul Smedley has built a SVN client available at http://download.smedley.info/subversion-1.5.5-os2-20081223.zip. Entering this command

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

will create a directory called ffmpeg below where you entered the command and download the source. To update the source you can enter

svn update

in the ffmpeg directory. Further information including a web interface to the source and links to daily snapshots are available at http://ffmpeg.mplayerhq.hu/download.html

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 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 is supported for building. 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 enviroment from scratch http://developer.mozilla.org/en/docs/OS/2_Build_Prerequisites has links to many ported packages.

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/ffmpeg

Note uses slashes instead of backslashes.

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. Basic lgpl licensed FFmpeg can be compiled as

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

or

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

then

make

At this point

make install

Will install 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

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 --enable-swscale --disable-debug

with all options as one line.

Testing FFmpeg

Your FFmpeg build can be tested by running

 make test

Note that currently you need to build with swscale support which is licensed GPL. So for example build with

 sh ./configure --enable-swscale --enable-gpl

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.

Unluckily currently FFmpeg fails a couple of tests. Adding

 --disable-mmx

to the configure line will help pass the tests if FFmpeg is built with GCC 3.3.5. This points to the errors being minor rounding errors.

GCC 4.3.3 has a different failure consisting of a crash. This will hopefully go away once more work is done with the 4.3.3 port of GCC. The crash information will be written to /tmp

Various Hints

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