Using FFmpeg

This page documents how to use FFmpeg with the Alveo U30 accelerated transcode pipeline.


Introduction

FFmpeg is an industry standard, open source, widely used utility for handling video. FFmpeg has many capabilities, including encoding and decoding all video compression formats, encoding and decoding audio, encapsulating, and extracting audio, and video from transport streams, and many more.

FFmpeg is the primary interface to the Alveo U30 accelerated transcode pipeline. Xilinx supplies an enhanced version of FFmpeg that can communicate with the hardware accelerated transcode pipeline.

It is not within the scope of this document to provide an exhaustive guide on the usage of FFmpeg. Various resources can be found online, for example:

The following sections describe the options used with FFmpeg to configure the various hardware accelerators available on the Alveo U30 card.


Example Commands

A simple FFmpeg command for accelerated encoding on Alveo U30 will look similar to this one:

ffmpeg -c:v mpsoc_vcu_h264 -i infile.mp4 -c:v mpsoc_vcu_hevc -s:v 1920x1080 -b:v 1000K -r 60 -f mp4 -y transcoded.mp4

There are many other ways in which FFmpeg can be used to leverage the video transcoding features of the Alveo U30 card. Examples illustrating how to run FFmpeg for encoding, decoding, and transcoding with and without ABR scaling. To see examples of all these possibilities, refer to the FFmpeg tutorials included in this repository.


Using FFmpeg for Video Encoding and Decoding on Alveo U30

General FFmpeg Options

Options

Descriptions

-i
The input file.
-b:v
Specify the video bitrate.
You can specify this in Mb or Kb. For example -b:v 1M or -b:v 1000K.
Can be specified in Mb or Kb. For example -b:v 1M or -b:v 1000K
-c:v
Specify the video codec.
This option must be set for any video stream sent to a Alveo U30 device.
Valid values are mpsoc_vcu_hevc (for HEVC) or mpsoc_vcu_h264 (for H.264)
-f
The container format.
-r
The frame rate in fps (Hz).
-filter_complex
Used to specify ABR scaling options.
Consult the Setting up an ABR ladder section for more details on how to use this option.
-xlnx_hwdev
Specify on which Alveo U30 device the FFmpeg job should run
Valid values are positive integers. Default is device 0.
Consult the Using Explicit Device IDs section for more details on how to use this option.

Alveo U30 Encoder Options

Options

Descriptions

-cores
Number of encoder cores in the Alveo U30 to utilize
Valid values: 0 to 4
The Alveo U30 devices are built of encoder and decoder cores that each run at 1080p60, and 1080p120
speed, respectively. This means to operate on a 4kp60 (maximum throughput of the chip), all cores
are fully utilized automatically. If you operate on a smaller file (e.g. a single 1080p60 clip),
you can leverage all of the cores to increase the FPS at which it processes. This is particularly
useful in “faster than realtime” (FTRT) use cases, where you want to finish encoding of a clip as fast
as possible. The -cores option will provide diminishing returns when multiple streams are
processed on the same device. Likewise, this option has limited value on livestreaming use-cases as
you cannot operate on a video stream faster than you receive it.
-slices
Number of slices to operate on at once within a core
Valid values: 0 to 68
Slices are a fundamental part of the stream format. You can operate on these in parallel to increase
speed at which a stream is processed.
However, operating on multiple “slices” of video at once will have negative video quality.
When used in conjunction with -cores, you can maximize the processing FPS on video streams.
This option must be used when encoding 4k streams to H.264 in order to sustain real-time performance.
-g
GOP size
Set this to 2x frame rate for a 2 second GOP
-level
Encoding level restriction
1 (default). If the user does not set this value, the encoder will automatically assign appropriate
level based on resolution, frame rate and bitrate
Valid values for H.264: 1, 1.1, 1.2, 1.3, 2, 2.1, 2.2, 3, 3.1, 3.2, 4, 4.1, 4.2, 5, 5.1, 5.2
Valid values for HEVC: 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1
-profile
Set the encoding profile
Valid values for H.264: high (default), baseline, main
Valid values for HEVC: main (default), main-intra
-max-bitrate
Maximum bitrate
Valid values: 0 to 3.5e+10 (default 5e+06)
You may want to use this to limit encoding bitrate if you have not specified a -b:v bitrate
-periodicity-idr
IDR picture frequency
Valid values: 0 to UINT32_MAX (default)
-bf
Number of B frames
Valid values: 0 to 4 (default is 2)
For tuning use 1 or 2 to improve video quality at the cost of latency.
Consult the B Frames section for more details on how to use this option.
-lookahead_depth
Number of frames to lookahead for qp maps
Valid values: 0 (default) to 20
For tuning set this to 20 to improve subjective video quality at the cost of latency.
Lookahead is not supported when encoding 4k streams.
Consult the Lookahead section for more details on how to use this option.
-qp-mode
QP control mode
Valid values: auto (default), relative_load, uniform
For tuning use uniform for best objective scores
Consult the Adaptive Quantization section for more details on how to use this option.
-spatial-aq
Enable spatial AQ
Valid values: disable or enable (default)
Consult the Adaptive Quantization section for more details on how to use this option.
-spatial-aq-gain
Percentage of spatial AQ gain.
Valid values: 0 to 100 (default 50)
Consult the Adaptive Quantization section for more details on how to use this option.
-temporal-aq
Enable temporal AQ
Valid values: disable or enable (default)
Consult the Adaptive Quantization section for more details on how to use this option.
-scaling-list
Determine if the quantization values are auto scaled
Valid values: 0, 1 (default)
Consult the Scaling List section for more details on how to use this option.
-vsync
Add in a vsync frame
Valid values: 0, 1
Set this to 0 to prevent extra frames being added.

Alveo U30 Decoder Options

Options

Descriptions

-low_latency
Configure decoder to handle out-of-order frames in order to decrease the latency of the system.
IMPORTANT: This option should not be used when processing streams containing B frames.
Valid values: 0 (default) and 1
-entropy_buffers_count
Specify number of internal entropy buffers.
Valid values: 2 (default) to 10
Can be used to improve the performance of ABR ladders for input streams with a high bitrate
or a high number of reference frames. 2 is enough for most cases. 5 is the practical limit.
-splitbuff_mode
Configure decoder in split/unsplit input buffer mode.
Valid values: 0 (default) and 1

Alveo U30 Miscellaneous Options

Options

Descriptions

-latency_logging
Log latency information to syslog.
Valid values: 0 (disabled, default) and 1 (enabled)
-loglevel
Configures the FFmpeg log level.
Setting this option to debug displays comprehensive debug information about the job

Tuning Visual Quality of Encoded Video

The quality of encoded video depends on various factors. It is primarily a function of target bit rate and type of video content. However, there are some encoder parameters which can be used to adjust the video quality in the Alveo U30 card.

The sections below describe the major FFmpeg options impacting visual quality. Various examples illustrating the effect of these settings can be found here: Quality analysis examples.

Number of B Frames

The number of B frames can be adjusted according to the amount of motion in the video content. Xilinx suggests setting B frames to 2 for static scenes, slow to medium motion, talking head, or video conferencing type content and 1 for gaming and fast motion content.

To change B frames, use the -bf option on the FFmpeg command line. Valid values are 0 to 4, default is 2.

Lookahead

Lookahead is used to improve the accuracy of rate control by enabling the encoder to buffer a specified number of frames (using the parameter). Spatial and temporal complexity measures are computed for these frames. The rate control uses these measures to distribute more bits to frames which are hard to encode, and less bits to frames which are easy to encode. This redistribution results in better video quality. When latency is tolerable in applications, Xilinx recommends a lookahead depth of 20 frames to get optimum video quality.

To enable lookahead, use the -lookahead_depth option on the FFmpeg command line.

Adaptive Quantization

This tool improves the visual quality by changing the quantization parameter (QP) within a frame. The QP for each frame is determined by the rate control, and adaptive quantization (AQ) adjusts QP on top of that for different regions within a frame. It exploits the fact that the human eye is more sensitive to certain regions of a frame and redistributes more bits to those regions.

The Alveo U30 card supports two types of AQ: Spatial Adaptive Quantization and Temporal Adaptive Quantization. Both of these AQ modes are enabled by default, and -qp-mode is set to relative-load when -lookahead_depth >= 1.

Spatial Adaptive Quantization

Spatial AQ adjusts the QP within a frame based on the spatial characteristics. The human eye is more sensitive to regions which are flat and have low texture than regions which have lots of detail and texture. Spatial AQ exploits this and provides more bits to the low texture and flat regions at the expense of high texture regions. This redistribution of bits to visually perceptible regions of the frame brings about visual improvement. Although spatial AQ improves visual quality, it hurts objective metrics and causes a drop in PSNR and VMAF. It is recommended to turn this feature off when performing PSNR/VMAF based evaluation.

The spatial AQ algorithm can be controlled using the -spatial-aq-gain option. The range of this option is from 0 to 100 and indicates the strength of this algorithm as a percentage.

To enable spatial AQ, set the -spatial-aq-gain to 1 and the -spatial-aq-gain to 50 on the FFmpeg command line. If no value is specified for the -spatial-aq-gain option, the default value is 50.

Temporal Adaptive Quantization

Temporal AQ adjusts the QP based on the temporal characteristics of the sequence. It utilizes the lookahead frames to capture the temporal characteristics where static/low motion or background is differentiated with high motion regions. The high motion regions are not very sensitive to the human eye as compared with low motion regions. Temporal AQ exploits this fact and redistributes more bits to static or low motion regions.

To enable temporal AQ, set the -temporal-aq option to 1 on the FFmpeg command line.

Scaling List

Scaling list offers a mechanism to scale the transform coefficients by specifying scaling matrices. This influences the quality of encoded video. There are two options to specify the scaling lists mode: 0 = default and 1 = flat.

For visual quality improvements, the scaling list mode must be set to default. The default scaling mode gives more importance to low-frequency coefficients and less importance to high-frequency coefficients. To improve the objective numbers (such as PSNR and VMAF), the scaling mode must be set to flat, where all the coefficients are scaled equally.

To change the scaling list mode, use the -scaling-list option (0 = flat, 1 = default) on the FFmpeg command line.

Considerations for Decoding and Encoding 4K Streams

The Xilinx Video SDK solution supports real-time decoding and encoding of 4k streams with the following notes:

  • The Alveo U30 video pipeline is optimized for live-streaming use cases. For 4k streams with bitrates significantly higher than the ones typically used for live streaming, it may not be possible to sustain real-time performance.

  • When decoding 4k streams with a high bitrate, increasing the number of entropy buffers using the -entropy_buffers_count option can help improve performance

  • When encoding raw video to 4k, set the -s option to 3840x2160 to specify the desired resolution.

  • When encoding 4k streams to H.264, the -slices option is required to sustain real-time performance. A value of 4 is recommended. This option is not required when encoding to HEVC.

  • The lookahead feature is not supported for 4k. FFmpeg will give an error if -lookahead_depth is enabled when encoding to 4k.


Using FFmpeg for Video Scaling on Alveo U30

The Alveo U30 card provides hardware-accelerated video decoding, scaling, and encoding. Each device on an Alveo U30 card supports multiple input channels (raw or encoded) up to a total equivalent bandwidth of 4kp60. Using the Multiscale XMA FFmpeg plug-in included in the Xilinx Video SDK, each input channel can be scaled in hardware to multiple lower resolution and/or lower frame rate outputs.

The Xilinx Video SDK supports the following scaling features and capabilities:

  • Up to 32 input streams of raw or encoded video can be scaled down per device

  • Each input stream can be scaled down to a maximum of 8 outputs streams of lower resolution and/or lower frame rate

  • Up to 32 scaled outputs streams are supported per device, up to a maximum total equivalent bandwidth of 4kp60

  • The scaler supports spatial resolutions from 3840x2160 to 128x128, in multiples of 4

  • Scaled output streams can optionally be encoded to H.264 of HEVC, using the same codec for all streams

  • The scaler passes scaled frames and meta data to the next scaling level (if one is defined) and to the encoder (if one is being used)

  • Each level of scaling adds a little more latency to the pipeline

For additional details about the specification of the hardware scaler, refer to the Adaptive Bitrate Scaler features section in the introductory chapter of this user guide.

The figure below illustrates a scaling ladder with a 1920x1080 input and 4 outputs with resolutions of 1280x720, 852x480, 640x360, and 416x240, respectively.

output from one rung is passed to the next for further scaling

IMPORTANT: The frame rate and resolution of a given output should be smaller or equal than the rate of the previous output. Since the output of one scaling stage is passed as an input to the next, visual quality will be negatively affected if frame rate is increased after it has been lowered.

Using the Alveo U30 Multiscale Filter

This section describes the FFmpeg syntax to configure the scaler, create ABR ladders and use the corresponding output streams.

An ABR ladder is created using the FFmpeg -filter_complex "<filter graph>" syntax. The filter graph specification should be constructed in the following way:

  • Add the multiscale_xma filter to the graph

  • Set the number of scaler outputs

  • Set the width, height, and rate settings for each scaler output

  • Define the name each scaler output

  • If the outputs are not to encoded on the device, add xvbm_convert filters to the filter graph to reformat the pixels

The filter graph syntax must follow these rules:

  • The entire filter graph sequence must be enclosed in quotes (")

  • Each option of the multiscale_xma filter (outputs, width, height, rate) must be separated by a colon (:)

  • A white space must separate the last multiscale_xma option from the list of output names

  • If xvbm_convert filters must be added to the filter graph, they must be preceded by a semi-colon (;)

  • The filter graph sequence should not end with ;"

The FFmpeg -map command is used to map and use each scaled output stream. All options of the -map commands must be separated by white spaces.

The following example shows a complete command to decode, scale and encode to two resolutions on device:

ffmpeg -y -c:v mpsoc_vcu_h264 -i 1080p60_input.mp4 \
    -filter_complex "multiscale_xma=outputs=2: \
    out_1_width=1280: out_1_height=720: out_1_rate=full: \
    out_2_width=640:  out_2_height=360: out_2_rate=half \
    [a][b]" \
    -map "[a]"       -b:v 3M    -c:v mpsoc_vcu_h264 -f mp4 -y 720p60.mp4 \
    -map "[b]" -r 30 -b:v 1250K -c:v mpsoc_vcu_h264 -f mp4 -y 360p30.mp4

The following example shows a complete command to decode, scale and send two resolutions to the host for postprocessing:

ffmpeg -y -c:v mpsoc_vcu_h264 -i 1080p60_input \
    -filter_complex "multiscale_xma=outputs=2: \
    out_1_width=1280: out_1_height=720:  \
    out_2_width=640:  out_2_height=360 \
    [a][b]; [a]xvbm_convert[aa]; [b]xvbm_convert[bb]" \
    -map "[aa]" -f rawvideo -pix_fmt nv12 720p60.yuv \
    -map "[bb]" -f rawvideo -pix_fmt yuv420p 360p60.yuv

Alveo U30 Multiscale Filter Options

multiscale_xma

Filter implementing the Xilinx ABR multiscaler. Takes one input and up to 8 output streams. The complete list of options is described below.

Multiscale Filter Options

Options

Description

outputs
Specify the number of scaler outputs
Valid values are integers between 1 and 8
out_{N}_width
Specify the width of each of the scaler outputs
The output number {N} must be an integer value between 1 and 8, and must not exceed the number of outputs
specified with outputs
Valid values are integers between 3840 and 128, in multiples of 4
The frame resolution of a given output should be smaller or equal than the resolution of the previous output
out_{N}_height
Specify the height of each of the scaler outputs
The output number {N} must be an integer value between 1 and 8, and must not exceed the number of outputs
specified with outputs
Valid values are integers between 2160 and 128, in multiples of 4
The frame resolution of a given output should be smaller or equal than the resolution of the previous output
out_{N}_rate
Specify the frame rate of each of the scaler outputs
By default, the scaler uses the input stream frame rate for all outputs. While the encoder supports frame
dropping with the -r option, there is also hardware support in the scaler for dropping frames. Dropping
frames in the scaler is preferred since it saves scaler bandwidth, allowing the scaler and encoder to operate
more efficiently.
The output number {N} must be an integer value between 1 and 8, and must not exceed the number of outputs
specified with outputs
Valid values are full (default) and half
The first output has to be full rate output (out_1_rate=full)
The frame rate of a given output should be smaller or equal than the resolution of the previous output.

Encoding Scaler Outputs

The outputs of an ABR ladder can be encoded on the device using either the mpsoc_vcu_h264 or the mpsoc_vcu_hevc codec. All outputs must be encoded using the same codec.

The following snippet shows how the desired codec is specified for each of the scaler outputs:

...
-map "[a]" -b:v 4M    -c:v mpsoc_vcu_h264 -f mp4 720p60_output.mp4 \
-map "[b]" -b:v 1500k -c:v mpsoc_vcu_h264 -f mp4 480p60_output.mp4

A full example of a raw to encoded ABR ladder can be found here: Encode Only Into Multiple Resolution Outputs.

Using Raw Scaler Outputs

To return raw video outputs from the ABR ladder, use the xvbm_convert filter to copy the frames from the device to the host and set the desired pixel formal, as shown in this command snippet:

...
[a]xvbm_convert[aa]; [b]xvbm_convert[bb]; \
-map "[aa]" -f rawvideo -pix_fmt nv12    -y ./outdir/720p60_nv12.yuv \
-map "[bb]" -f rawvideo -pix_fmt yuv420p -y ./outdir/480p60_yuv420.yuv

Performance Considerations

Encoded input streams with a high bitrate or with a high number of reference frames can degrade the performance of an ABR ladder. The -entropy_buffers_count decoder option can be used to help with this. A value of 2 is enough for most cases, 5 is the practical limit.


Moving Data through the Video Pipeline

Automatic Data Movement

The Xilinx Video SDK takes care of moving data efficiently through the FFmpeg pipeline in these situations:

Individual operations:

  • Decoder input: encoded video is automatically sent from the host to the device

  • Scaler input: raw video is automatically sent from the host to the device

  • Encoder input: raw video is automatically sent from the host to the device

  • Encoder output: encoded video is automatically sent from the device to the host

Multistage pipelines

  • Pipelines with hardware accelerators only (such as transcoding with ABR ladder): the video frames remain on the device and are passed from one accelerator to the next, thereby avoiding unnecessary data movement between the host and the device

  • Pipelines with software filters: when using the ouput of the decoder or the scaler with a FFmpeg software filter, the video frames are automatically copied back to the host, as long as the software filter performs frame cloning. Examples of such filters include fps and split.

Explicit Data Movement

It is necessary to explicitly copy video frames from the device to the host in these situations:

  • Writing the output of the decoder or the scaler to file.

  • Using the output of the decoder or the scaler with a software filter which does not perform frame cloning. Examples of such filters include the transpose filter used for frame rotation.

This is done using the xvbm_convert filter.

xvbm_convert

FFmpeg filter which converts and copies a XVBM frame on the device to an AV frame on the host

Examples using the xvbm_convert filter can be found here:


Rebuilding FFmpeg

There are two methods for rebuilding FFmpeg with the Xilinx Video SDK plugins enabled:

  • Using the complete source code

  • Using the git patch file

Using the Source Code

The sources/app-ffmpeg4-xma submodule contains the entire source code for the FFmpeg executable included with the Video SDK. This is a fork of the main FFmpeg GitHub (release 4.1, commid ID bb01cd3cc01c9982e4b57f8ce5cfd6ec4724f848) with a Xilinx patch applied to enable the Xilinx Video SDK plugins. Due to licensing restrictions, the FFmpeg executable included in the Video SDK is enabled with the Xilinx Video SDK plugins only.

You can rebuild the FFmpeg executable with optional plugins by following the instructions below. Additionally, comprehensive instructions for compiling FFmpeg can be found on the FFmpeg wiki page.

  1. Make sure nasm and yasm are installed on your machine.

  2. Navigate the top of the Xilinx Video SDK repository:

    cd /path/to/video-sdk
    
  3. Make sure the sources have been downloaded from the repository:

    git submodule update --init --recursive
    
  4. Navigate to the directory containing the FFmpeg sources:

    cd sources/app-ffmpeg4-xma
    
  5. Optionally install FFmpeg plugins you wish to enable (either from source or from your package manager like yum or apt). For example: libx264, or libx265.

  6. Configure FFmpeg with --enable flags to enable the desired plugins. The -enable-libxma2api flag enables the U30 plugins. The command below will configure the Makefile to install the custom FFmpeg in the /tmp/ffmpeg directory. To install in another location, modify the --prefix and --datadir options:

    ./configure --prefix=/tmp/ffmpeg --datadir=/tmp/ffmpeg/etc  --enable-x86asm --enable-libxma2api --disable-doc --enable-libxvbm --enable-libxrm --extra-cflags=-I/opt/xilinx/xrt/include/xma2 --extra-ldflags=-L/opt/xilinx/xrt/lib --extra-libs=-lxma2api --extra-libs=-lxrt_core --extra-libs=-lxrt_coreutil --extra-libs=-lpthread --extra-libs=-ldl --disable-static --enable-shared
    
  7. Build and install the FFmpeg executable:

    make -j && sudo make install
    
  8. The /opt/xilinx/xcdr/setup.sh script puts the Xilinx-provided FFmpeg in the PATH environment variable. To use the newly built FFmpeg, update your PATH or provide the full path to the custom-built executable.


Using the Git Patch File

The Xilinx patch applied folder contains a git patch file which can be applied to a FFmpeg fork to enable the Xilinx Video SDK plugins.

This patch is designed to apply to FFmpeg n4.1. As such, applying this patch to earlier or later versions of FFmpeg may require edits to successfully merge these changes and represent untested configurations.

The patch adds new plugins to FFmpeg to enable access to Xilinx U30 Video accelerators. In addition, the patch makes edits to FFmpeg to support new command line options to support U30-based FPGA use cases as well as ensure proper initialization of Xilinx accelerators.

Here is an example of how the patch can be applied to a FFmpeg fork:

  1. Clone the n4.1 version of FFmpeg:

    git clone https://github.com/FFmpeg/FFmpeg.git -b n4.1
    
  2. After the git clone, you will have a directory named FFmpeg. Enter this directory:

    cd FFmpeg
    
  3. Copy the patch file into the FFmpeg directory:

    cp /path/to/sources/app-ffmpeg4-xma-patch/0001-Add-plugins-to-support-U30-based-Video-SDK-v1.0.0.patch .
    
  4. Apply the patch:

    git am 0001-Add-plugins-to-support-U30-based-Video-SDK-v1.0.0.patch --ignore-whitespace --ignore-space-change
    
  5. You can then install additional FFmpeg plugins and proceed with the FFmpeg build and installation process.


Xilinx FFmpeg Reference Guide

H.264 Codec Reference

H.264 Decoder Options

The entire list options for the Alveo U30 H.264 decoder (mpsoc_vcu_h264) can be displayed using the following command:

ffmpeg -h decoder=mpsoc_vcu_h264

The mpsoc_vcu_h264 decoder has the following options:

Decoder mpsoc_vcu_h264 [MPSOC H.264 Decoder]:
    General capabilities: delay avoidprobe
    Threading capabilities: none
    Supported pixel formats: xlnx_xvbm
MPSOC H.264 decoder AVOptions:
  -low_latency       <int>        .D.V..... Should low latency decoding be used (from 0 to 1) (default 0)
  -entropy_buffers_count <int>        .D.V..... Specify number of internal entropy buffers (from 2 to 10) (default 2)
  -latency_logging   <int>        .D.V..... Log latency information to syslog (from 0 to 1) (default 0)
  -splitbuff_mode    <int>        .D.V..... configure decoder in split/unsplit input buffer mode (from 0 to 1) (default 0)

H.264 Encoder Options

The entire list options for the Alveo U30 H.264 encoder (mpsoc_vcu_h264) can be displayed using the following command:

ffmpeg -h encoder=mpsoc_vcu_h264

The mpsoc_vcu_h264 encoder has the following options:

Encoder mpsoc_vcu_h264 [MPSOC H.264 Encoder]:
    General capabilities: delay threads
    Threading capabilities: auto
    Supported pixel formats: xlnx_xvbm nv12
MPSOC VCU H264 encoder AVOptions:
  -control-rate      <int>        E..V..... Rate Control Mode (from 0 to 3) (default cbr)
     const-qp                     E..V..... Constant QP
     cbr                          E..V..... Constant Bitrate
     vbr                          E..V..... Variable Bitrate
     low-latency                  E..V..... Low Latency
  -max-bitrate       <int64>      E..V..... Maximum Bit Rate (from 0 to 3.5e+10) (default 5e+06)
  -slice-qp          <int>        E..V..... Slice QP (from -1 to 51) (default auto)
     auto                         E..V..... Auto
  -min-qp            <int>        E..V..... Minimum QP value allowed for the rate control (from 0 to 51) (default 0)
  -max-qp            <int>        E..V..... Maximum QP value allowed for the rate control (from 0 to 51) (default 51)
  -bf                <int>        E..V..... Number of B-frames (from 0 to UINT32_MAX) (default 2)
  -periodicity-idr   <int>        E..V..... IDR Picture Frequency (from -1 to UINT32_MAX) (default -1)
  -profile           <int>        E..V..... Set the encoding profile (from 66 to 100) (default high)
     baseline                     E..V..... Baseline profile
     main                         E..V..... Main profile
     high                         E..V..... High profile
  -level             <int>        E..V..... Set the encoding level restriction (from 10 to 52) (default 1)
     1                            E..V..... 1 level
     1.1                          E..V..... 1.1 level
     1.2                          E..V..... 1.2 level
     1.3                          E..V..... 1.3 level
     2                            E..V..... 2 level
     2.1                          E..V..... 2.1 level
     2.2                          E..V..... 2.2 level
     3                            E..V..... 3 level
     3.1                          E..V..... 3.1 level
     3.2                          E..V..... 3.2 level
     4                            E..V..... 4 level
     4.1                          E..V..... 4.1 level
     4.2                          E..V..... 4.2 level
     5                            E..V..... 5 level
     5.1                          E..V..... 5.1 level
     5.2                          E..V..... 5.2 level
  -slices            <int>        E..V..... Number of Slices (from 1 to 68) (default 1)
  -qp-mode           <int>        E..V..... QP Control Mode (from 0 to 2) (default auto)
     uniform                      E..V..... Use the same QP for all coding units of the frame
     auto                         E..V..... Let the VCU encoder change the QP for each coding unit according to its content
     relative-load                E..V..... Use the information gathered in the lookahead to calculate the best QP
  -aspect-ratio      <int>        E..V..... Aspect-Ratio (from 0 to 3) (default auto)
     auto                         E..V..... 4:3 for SD video, 16:9 for HD video, unspecified for unknown format
     4:3                          E..V..... 4:3 aspect ratio
     16:9                         E..V..... 16:9 aspect ratio
     none                         E..V..... Aspect ratio information is not present in the stream
  -scaling-list      <int>        E..V..... Scaling List Mode (from 0 to 1) (default default)
     flat                         E..V..... Flat scaling list mode
     default                      E..V..... Default scaling list mode
  -cores             <int>        E..V..... Number of cores to use (from 0 to 4) (default auto)
     auto                         E..V..... Automatic
  -lookahead_depth   <int>        E..V..... Number of frames to lookahead for qp maps generation or custom rate control. Up to 20 (from 0 to 20) (default 0)
  -temporal-aq       <int>        E..V..... Enable Temporal AQ. (from 0 to 1) (default enable)
     disable                      E..V..... Disable Temporal AQ
     enable                       E..V..... Enable Temporal AQ
  -spatial-aq        <int>        E..V..... Enable Spatial AQ. (from 0 to 1) (default enable)
     disable                      E..V..... Disable Spatial AQ
     enable                       E..V..... Enable Spatial AQ
  -spatial-aq-gain   <int>        E..V..... Percentage of spatial AQ gain (from 0 to 100) (default 50)
  -latency_logging   <int>        E..V..... Log latency information to syslog (from 0 to 1) (default 0)
  -expert-options    <string>     E..V..... Expert options for MPSoC H.264 Encoder
  -tune-metrics      <int>        E..V..... Tunes MPSoC H.264 Encoder's video quality for objective metrics (from 0 to 1) (default disable)
     disable                      E..V..... Disable tune metrics
     enable                       E..V..... Enable tune metrics

HEVC Codec Reference

HEVC Decoder Options

The entire list options for the Alveo U30 HEVC decoder (mpsoc_vcu_hevc) can be displayed using the following command:

ffmpeg -h decoder=mpsoc_vcu_hevc

The mpsoc_vcu_hevc decoder has the following options:

Decoder mpsoc_vcu_hevc [MPSOC HEVC Decoder]:
    General capabilities: delay avoidprobe
    Threading capabilities: none
    Supported pixel formats: xlnx_xvbm
MPSOC HEVC decoder AVOptions:
  -low_latency       <int>        .D.V..... Should low latency decoding be used (from 0 to 1) (default 0)
  -entropy_buffers_count <int>        .D.V..... Specify number of internal entropy buffers (from 2 to 10) (default 2)
  -latency_logging   <int>        .D.V..... Log latency information to syslog (from 0 to 1) (default 0)
  -splitbuff_mode    <int>        .D.V..... configure decoder in split/unsplit input buffer mode (from 0 to 1) (default 0)

HEVC Encoder Options

The entire list options for the Alveo U30 HEVC encoder (mpsoc_vcu_hevc) can be displayed using the following command:

ffmpeg -h encoder=mpsoc_vcu_hevc

The mpoc_vcu_hevc encoder has the following options:

Encoder mpsoc_vcu_hevc [MPSOC VCU HEVC Encoder]:
    General capabilities: delay threads avoidprobe
    Threading capabilities: auto
    Supported pixel formats: xlnx_xvbm nv12
MPSOC VCU HEVC encoder AVOptions:
  -control-rate      <int>        E..V..... Rate Control Mode (from 0 to 3) (default cbr)
     const-qp                     E..V..... Constant QP
     cbr                          E..V..... Constant Bitrate
     vbr                          E..V..... Variable Bitrate
     low-latency                  E..V..... Low Latency
  -max-bitrate       <int64>      E..V..... Maximum Bit Rate (from 0 to 3.5e+10) (default 5e+06)
  -slice-qp          <int>        E..V..... Slice QP (from -1 to 51) (default auto)
     auto                         E..V..... Auto
  -min-qp            <int>        E..V..... Minimum QP value allowed for the rate control (from 0 to 51) (default 0)
  -max-qp            <int>        E..V..... Maximum QP value allowed for the rate control (from 0 to 51) (default 51)
  -bf                <int>        E..V..... Number of B-frames (from 0 to UINT32_MAX) (default 2)
  -periodicity-idr   <int>        E..V..... IDR Picture Frequency (from -1 to UINT32_MAX) (default -1)
  -profile           <int>        E..V..... Set the encoding profile (from 0 to 1) (default main)
     main                         E..V..... Main profile
     main-intra                   E..V..... Main Intra profile
  -level             <int>        E..V..... Set the encoding level restriction (from 10 to 51) (default 1)
     1                            E..V..... 1 level
     2                            E..V..... 2 level
     2.1                          E..V..... 2.1 level
     3                            E..V..... 3 level
     3.1                          E..V..... 3.1 level
     4                            E..V..... 4 level
     4.1                          E..V..... 4.1 level
     5                            E..V..... 5 level
     5.1                          E..V..... 5.1 level
  -tier              <int>        E..V..... Set the encoding tier (from 0 to 1) (default main)
     main                         E..V..... Main tier
     high                         E..V..... High tier
  -slices            <int>        E..V..... Number of Slices (from 1 to 68) (default 1)
  -qp-mode           <int>        E..V..... QP Control Mode (from 0 to 2) (default auto)
     uniform                      E..V..... Use the same QP for all coding units of the frame
     auto                         E..V..... Let the VCU encoder change the QP for each coding unit according to its content
     relative-load                E..V..... Use the information gathered in the lookahead to calculate the best QP
  -aspect-ratio      <int>        E..V..... Aspect-Ratio (from 0 to 3) (default auto)
     auto                         E..V..... 4:3 for SD video, 16:9 for HD video, unspecified for unknown format
     4:3                          E..V..... 4:3 aspect ratio
     16:9                         E..V..... 16:9 aspect ratio
     none                         E..V..... Aspect ratio information is not present in the stream
  -scaling-list      <int>        E..V..... Scaling List Mode (from 0 to 1) (default default)
     flat                         E..V..... Flat scaling list mode
     default                      E..V..... Default scaling list mode
  -cores             <int>        E..V..... Number of cores to use (from 0 to 4) (default auto)
     auto                         E..V..... Automatic
  -lookahead_depth   <int>        E..V..... Number of frames to lookahead for qp maps generation or custom rate control. Up to 20 (from 0 to 20) (default 0)
  -temporal-aq       <int>        E..V..... Enable Temporal AQ. (from 0 to 1) (default enable)
     disable                      E..V..... Disable Temporal AQ
     enable                       E..V..... Enable Temporal AQ
  -spatial-aq        <int>        E..V..... Enable Spatial AQ. (from 0 to 1) (default enable)
     disable                      E..V..... Disable Spatial AQ
     enable                       E..V..... Enable Spatial AQ
  -spatial-aq-gain   <int>        E..V..... Percentage of spatial AQ gain (from 0 to 100) (default 50)
  -latency_logging   <int>        E..V..... Log latency information to syslog (from 0 to 1) (default 0)
  -expert-options    <string>     E..V..... Expert options for MPSoC HEVC Encoder
  -tune-metrics      <int>        E..V..... Tunes MPSoC HEVC Encoder's video quality for objective metrics (from 0 to 1) (default disable)
     disable                      E..V..... Disable tune metrics
     enable                       E..V..... Enable tune metrics

Multiscaler Filter Reference

The entire list options for the Alveo U30 Multiscaler (multiscale_xma) can be displayed using the following command:

ffmpeg -h filter=multiscale_xma

The multiple output hardware scaling filter has the following options:

Filter multiscale_xma
  Xilinx Multi Scaler (in ABR mode) using XMA APIs
    Inputs:
       #0: default (video)
    Outputs:
        dynamic (depending on the options)
multiscale_xma AVOptions:
  outputs           <int>        ..FV..... set number of outputs (from 1 to 8) (default 8)
  out_1_width       <int>        ..FV..... set width of output 1 (should be multiple of 4) (from 128 to 3840) (default 1600)
  out_1_height      <int>        ..FV..... set height of output 1 (should be multiple of 4) (from 128 to 3840) (default 900)
  out_1_pix_fmt     <string>     ..FV..... set format of output 1 (default "xlnx_xvbm")
  out_1_rate        <string>     ..FV..... set rate of output 1 (default "full")
  out_2_width       <int>        ..FV..... set width of output 2 (should be multiple of 4) (from 128 to 3840) (default 1280)
  out_2_height      <int>        ..FV..... set height of output 2 (should be multiple of 4) (from 128 to 3840) (default 720)
  out_2_pix_fmt     <string>     ..FV..... set format of output 2 (default "xlnx_xvbm")
  out_2_rate        <string>     ..FV..... set rate of output 2 (default "full")
  out_3_width       <int>        ..FV..... set width of output 3 (should be multiple of 4) (from 128 to 3840) (default 800)
  out_3_height      <int>        ..FV..... set height of output 3 (should be multiple of 4) (from 128 to 3840) (default 600)
  out_3_pix_fmt     <string>     ..FV..... set format of output 3 (default "xlnx_xvbm")
  out_3_rate        <string>     ..FV..... set rate of output 3 (default "full")
  out_4_width       <int>        ..FV..... set width of output 4 (should be multiple of 4) (from 128 to 3840) (default 832)
  out_4_height      <int>        ..FV..... set height of output 4 (should be multiple of 4) (from 128 to 3840) (default 480)
  out_4_pix_fmt     <string>     ..FV..... set format of output 4 (default "xlnx_xvbm")
  out_4_rate        <string>     ..FV..... set rate of output 4 (default "full")
  out_5_width       <int>        ..FV..... set width of output 5 (should be multiple of 4) (from 128 to 3840) (default 640)
  out_5_height      <int>        ..FV..... set height of output 5 (should be multiple of 4) (from 128 to 3840) (default 480)
  out_5_pix_fmt     <string>     ..FV..... set format of output 5 (default "xlnx_xvbm")
  out_5_rate        <string>     ..FV..... set rate of output 5 (default "full")
  out_6_width       <int>        ..FV..... set width of output 6 (should be multiple of 4) (from 128 to 3840) (default 480)
  out_6_height      <int>        ..FV..... set height of output 6 (should be multiple of 4) (from 128 to 3840) (default 320)
  out_6_pix_fmt     <string>     ..FV..... set format of output 6 (default "xlnx_xvbm")
  out_6_rate        <string>     ..FV..... set rate of output 6 (default "full")
  out_7_width       <int>        ..FV..... set width of output 7 (should be multiple of 4) (from 128 to 3840) (default 320)
  out_7_height      <int>        ..FV..... set height of output 7 (should be multiple of 4) (from 128 to 3840) (default 240)
  out_7_pix_fmt     <string>     ..FV..... set format of output 7 (default "xlnx_xvbm")
  out_7_rate        <string>     ..FV..... set rate of output 7 (default "full")
  out_8_width       <int>        ..FV..... set width of output 8 (should be multiple of 4) (from 128 to 3840) (default 224)
  out_8_height      <int>        ..FV..... set height of output 8 (should be multiple of 4) (from 128 to 3840) (default 224)
  out_8_pix_fmt     <string>     ..FV..... set format of output 8 (default "xlnx_xvbm")
  out_8_rate        <string>     ..FV..... set rate of output 8 (default "full")
  latency_logging   <int>        ..FV..... Log latency information to syslog (from 0 to 1) (default 0)