Building Pi FFmpeg
==================

Current only building on a Pi is supported.
This builds ffmpeg the way I've tested it

Get all dependencies - the current package dependencies are good enough

$ sudo apt-get build-dep ffmpeg

Configure using the pi-util/conf_native.sh script
-------------------------------------------------

This sets the normal release options and creates an ouutput dir to build into
The directory name will depend on system and options but will be under out/

There are a few choices here
 --mmal  build including the legacy mmal-based decoders and zero-copy code
         this requires appropriate libraries which currently will exist for
         armv7 but not arm64
 --noshared
         Build a static image rather than a shared library one.  Static is
         easier for testing as there is no need to worry about library
         paths being confused and therefore running the wrong code,  Shared
         is what is needed, in most cases, when building for use by other
         programs.
 --usr   Set install dir to /usr (i.e. system default) rather than in
         <builddir>/install

So for a static build
---------------------

$ pi-util/conf_native.sh --noshared

$ make -j8 -C out/<wherever the script said it was building to>

You can now run ffmpeg directly from where it was built

For a shared build
------------------

There are two choices here

$ pi-util/conf_native.sh
$ make -j8 -C out/<builddir> install

This sets the install prefix to <builddir>/install and is probably what you
want if you don't want to overwrite the system files.

You can now set LD_LIBRARY_PATH appropriately and run ffmpeg from where it was
built. You can copy the contents of <build dir>/install to /usr and that mostly
works. The only downside is that paths in pkgconfig end up being set to the
install directory in your build directory which may be less than ideal when
building other packages.

The alternative if you just want to replace the system libs is:

$ pi-util/conf_native.sh --usr
$ make -j8 -C out/<builddir>
$ sudo pi-util/clean_usr_libs.sh
$ sudo make -j8 -C out/<builddir> install

The clean_usr_libs.sh step wipes any existing libs & includes (for all
architectures) from the system which helps avoid confusion when running other
progs as you can be sure you're not running old code which is unfortunately
easy to do otherwise.

