Skip to content

Docker support

Alexander Berezhnoi edited this page Apr 14, 2020 · 7 revisions

The Docker tool can be used to painlessly execute the ffmpeg-android-maker script.

Note, this is neither the only nor the main way to execute the ffmpeg-android-maker. The main use case is still native execution in macOS or Linux terminal.

The main benefit of using Docker is that you don't need to install any software required for compilation except the Docker itself. This can be a good fit for:

  • Systems that don't have particular versions of the required software
  • Systems that already depend on a different version of the required software
  • Developers who don't want to mess their workstations with the required software installation
  • Windows machines, as the ffmpeg-android-maker is a Shell script

Setup

First of all, the ffmpeg-android-maker repository has to be downloaded on your machine, as it needs to be provided to the Docker.

And the only thing is needed to be installed additionally - is the Docker itself. It is supported by macOS, Windows and certain distributions of Linux. Check this link out for the actual installation process description.

Having Docker installed already means that you are capable of successful execution of ffmpeg-android-maker.

Usage

There is a prebuilt image available on Docker Hub that can be used right away.

Image preload (optional)

You can preload the image with the following command:

docker pull javernaut/ffmpeg-android-maker

This step is optional, because the docker run command automatically downloads the image if it is absent.

Run, Docker, Run!

A Docker image has to be run in a container with docker run command. This command requires certain arguments.

The full pattern of the command looks like this:

docker run --rm \
  -v ${LOCAL_FAM_PATH}:/mnt/ffmpeg-android-maker \
  -e FAM_ARGS="${FAM_ARGS}" \
  javernaut/ffmpeg-android-maker

Here is what all these variables mean:

  • LOCAL_FAM_PATH - the absolute path to the ffmpeg-android-maker on your machine.
  • FAM_ARGS - arguments that can be passed to the ffmpeg-android-maker script directly. This is optional. Skip the whole -e ... line if you don't need to pass any arguments.

Examples:

  1. Compiling the FFmpeg without any external dependencies on Windows (note different slashes):
docker run --rm ^
  -v C:\path\to\ffmpeg-android-maker:/mnt/ffmpeg-android-maker ^
  javernaut/ffmpeg-android-maker
  1. Compiling everything ffmpeg-android-maker can for now on macOS or Linux:
docker run --rm \
  -v /absolute/path/to/ffmpeg-android-maker:/mnt/ffmpeg-android-maker \
  -e FAM_ARGS="--enable-libdav1d --enable-libaom --enable-libmp3lame --android-api-level=18" \
  javernaut/ffmpeg-android-maker

* The --android-api-level=18 is necessary in this case because the encoder in libaom uses API that is available only since Android API 18. Building only a decoder of libaom doesn't need this flag (the default API level is 16).

Since the ffmpeg-android-maker sources are provided to the image (and not already embedded), you are able to modify it as you want on your workstation and execute it in Docker.

How is the image structured?

The image is based on Ubuntu 19.10. The Dockerfile is pretty self-explanatory, so have a look for the actual list of software that is embedded into the image.

An image takes about 4.6 Gb of space on your machine.

Build from source

If you customize the ffmpeg-android-maker to support another external library, then probably you will need an altered Docker image. For that you can build one locally on your machine.

For that you will need to update the Dockerfile to install newly required software during the image construction. This reference may be helpful.

Just remember: you will need to specify your newly created image id instead of javernaut/ffmpeg-android-maker.

Clone this wiki locally