How to Pass Custom Options to libaom via FFmpeg?

This article provides a practical guide on using specific FFmpeg flags to pass custom encoding options to the libaom-av1 library. When encoding video to the AV1 format using FFmpeg, the standard parameters often fall short of utilizing every advanced tuning knob available in the Alliance for Open Media (AOM) reference encoder. By leveraging the -aom-params flag, developers and video engineers can fine-tune compression efficiency, control specific keyframe behaviors, and optimize encoding speeds.


Understanding the -aom-params Flag

The primary and most efficient way to pass custom options directly to the underlying libaom encoder in FFmpeg is by using the -aom-params flag. This flag accepts a list of key=value pairs, with each pair separated by a colon (:). It acts as a direct bridge to the internal libaom API configuration structure, overriding or supplementing standard FFmpeg options.

Using -aom-params is highly recommended over older, generic options like -x265-params or -vsprofile equivalents because it is tailored explicitly for AV1’s distinct encoder architecture.

Basic Syntax Structure

ffmpeg -i input.mp4 -c:v libaom-av1 -aom-params key1=value1:key2=value2 output.mkv

Common Custom Options for libaom

When constructing your -aom-params string, several high-impact variables can be fine-tuned to maximize your encoding workflow.

1. Keyframe and GOP Adjustments

2. Rate Control Tuning

3. Tiling and Threading

AV1 relies heavily on tiling to achieve multi-threaded encoding efficiency.


Advanced Implementation Example

To combine these concepts into a production-ready command line, you might look at a scenario aiming for high-efficiency multi-threaded 4K encoding.

The following command utilizes -aom-params to enforce a specific tile layout for parallel processing while forcing row-based multi-threading:

ffmpeg -i input.mov -c:v libaom-av1 -b:v 0 -crf 28 -aom-params tile-columns=2:tile-rows=1:row-mt=1:enable-tpl-model=1 output.mp4

In this setup, enable-tpl-model=1 activates Temporal Dependency Model R-D optimization, which improves bit allocation across frames based on motion and complexity, yielding a noticeably better quality-to-bitrate ratio.