Jump to content

FFmpeg: Difference between revisions

From EDM2
Dryeo (talk | contribs)
Dryeo (talk | contribs)
Line 45: Line 45:
  set PWD=x:/path/to/ffmpeg
  set PWD=x:/path/to/ffmpeg
Note uses slashes instead of backslashes.
Note uses slashes instead of backslashes.
Multithread support needs pthreads. A version is available at http://web.os2power.com/yuri/PthreadTls.


'''
'''

Revision as of 06:58, 12 September 2010

Getting FFmpeg

The best way to get FFmpeg sources is with SVN. Paul Smedley has built a SVN client available at http://os2ports.smedley.info/index.php?page=subversion. 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 and newer is supported for building. The newer the version of GCC the better, current version is 4.44. 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.

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.

Multithread support needs pthreads. 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, [1]