Decoders
********

Decoders are configured elements in FFmpeg which allow the decoding of multimedia streams.

When you configure your FFmpeg build, all the supported native decoders are enabled by default. Decoders requiring an external library must be enabled manually via the corresponding --enable-lib option. You can list all available decoders using the configure option --list-decoders.

You can disable all the decoders with the configure option --disable-decoders and selectively enable / disable single decoders with the options --enable-decoder=DECODER / --disable-decoder=DECODER.

The option -decoders of the ff* tools will display the list of enabled decoders.

Video Decoders
**************

A description of some of the currently available video decoders follows.

av1
===

AOMedia Video 1 (AV1) decoder.

Options
-------

operating_point
     Select an operating point of a scalable AV1 bitstream (0 - 31). Default is 0.

rawvideo
========

Raw video decoder.

This decoder decodes rawvideo streams.

Options
-------

top TOP_FIELD_FIRST
     Specify the assumed field type of the input video.

     -1
          the video is assumed to be progressive (default)

     0
          bottom-field-first is assumed

     1
          top-field-first is assumed

libdav1d
========

dav1d AV1 decoder.

libdav1d allows libavcodec to decode the AOMedia Video 1 (AV1) codec. Requires the presence of the libdav1d headers and library during configuration. You need to explicitly configure the build with --enable-libdav1d.

Options
-------

The following options are supported by the libdav1d wrapper.

framethreads
     Set amount of frame threads to use during decoding. The default value is 0 (autodetect). This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the option max_frame_delay and the global option threads instead.

tilethreads
     Set amount of tile threads to use during decoding. The default value is 0 (autodetect). This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the global option threads instead.

max_frame_delay
     Set max amount of frames the decoder may buffer internally. The default value is 0 (autodetect).

filmgrain
     Apply film grain to the decoded video if present in the bitstream. Defaults to the internal default of the library. This option is deprecated and will be removed in the future. See the global option export_side_data to export Film Grain parameters instead of applying it.

oppoint
     Select an operating point of a scalable AV1 bitstream (0 - 31). Defaults to the internal default of the library.

alllayers
     Output all spatial layers of a scalable AV1 bitstream. The default value is false.

libdavs2
========

AVS2-P2/IEEE1857.4 video decoder wrapper.

This decoder allows libavcodec to decode AVS2 streams with davs2 library.

libuavs3d
=========

AVS3-P2/IEEE1857.10 video decoder.

libuavs3d allows libavcodec to decode AVS3 streams. Requires the presence of the libuavs3d headers and library during configuration. You need to explicitly configure the build with --enable-libuavs3d.

Options
-------

The following option is supported by the libuavs3d wrapper.

frame_threads
     Set amount of frame threads to use during decoding. The default value is 0 (autodetect).

libxevd
=======

eXtra-fast Essential Video Decoder (XEVD) MPEG-5 EVC decoder wrapper.

This decoder requires the presence of the libxevd headers and library during configuration. You need to explicitly configure the build with --enable-libxevd.

The xevd project website is at https://github.com/mpeg5/xevd.

Options
-------

The following options are supported by the libxevd wrapper. The xevd-equivalent options or values are listed in parentheses for easy migration.

To get a more accurate and extensive documentation of the libxevd options, invoke the command  xevd_app --help or consult the libxevd documentation.

threads (threads)
     Force to use a specific number of threads

QSV Decoders
============

The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC, JPEG/MJPEG, VP8, VP9, AV1).

Common Options
--------------

The following options are supported by all qsv decoders.

ASYNC_DEPTH
     Internal parallelization depth, the higher the value the higher the latency.

GPU_COPY
     A GPU-accelerated copy between video and system memory

     default

     on

     off

HEVC Options
------------

Extra options for hevc_qsv.

LOAD_PLUGIN
     A user plugin to load in an internal session

     none

     hevc_sw

     hevc_hw

LOAD_PLUGINS
     A :-separate list of hexadecimal plugin UIDs to load in an internal session

v210
====

Uncompressed 4:2:2 10-bit decoder.

Options
-------

custom_stride
     Set the line size of the v210 data in bytes. The default value is 0 (autodetect). You can use the special -1 value for a strideless v210 as seen in BOXX files.

Audio Decoders
**************

A description of some of the currently available audio decoders follows.

ac3
===

AC-3 audio decoder.

This decoder implements part of ATSC A/52:2010 and ETSI TS 102 366, as well as the undocumented RealAudio 3 (a.k.a. dnet).

AC-3 Decoder Options
--------------------

-drc_scale VALUE
     Dynamic Range Scale Factor. The factor to apply to dynamic range values from the AC-3 stream. This factor is applied exponentially. The default value is 1. There are 3 notable scale factor ranges:

     drc_scale == 0
          DRC disabled. Produces full range audio.

     0 < drc_scale <= 1
          DRC enabled.  Applies a fraction of the stream DRC value. Audio reproduction is between full range and full compression.

     drc_scale > 1
          DRC enabled. Applies drc_scale asymmetrically. Loud sounds are fully compressed.  Soft sounds are enhanced.

flac
====

FLAC audio decoder.

This decoder aims to implement the complete FLAC specification from Xiph.

FLAC Decoder options
--------------------

-use_buggy_lpc
     The lavc FLAC encoder used to produce buggy streams with high lpc values (like the default value). This option makes it possible to decode such streams correctly by using lavc's old buggy lpc logic for decoding.

ffwavesynth
===========

Internal wave synthesizer.

This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly documented.

libcelt
=======

libcelt decoder wrapper.

libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. Requires the presence of the libcelt headers and library during configuration. You need to explicitly configure the build with --enable-libcelt.

libgsm
======

libgsm decoder wrapper.

libgsm allows libavcodec to decode the GSM full rate audio codec. Requires the presence of the libgsm headers and library during configuration. You need to explicitly configure the build with --enable-libgsm.

This decoder supports both the ordinary GSM and the Microsoft variant.

libilbc
=======

libilbc decoder wrapper.

libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC) audio codec. Requires the presence of the libilbc headers and library during configuration. You need to explicitly configure the build with --enable-libilbc.

Options
-------

The following option is supported by the libilbc wrapper.

enhance

     Enable the enhancement of the decoded audio when set to 1. The default value is 0 (disabled).

libopencore-amrnb
=================

libopencore-amrnb decoder wrapper.

libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate Narrowband audio codec. Using it requires the presence of the libopencore-amrnb headers and library during configuration. You need to explicitly configure the build with --enable-libopencore-amrnb.

An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB without this library.

libopencore-amrwb
=================

libopencore-amrwb decoder wrapper.

libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate Wideband audio codec. Using it requires the presence of the libopencore-amrwb headers and library during configuration. You need to explicitly configure the build with --enable-libopencore-amrwb.

An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB without this library.

libopus
=======

libopus decoder wrapper.

libopus allows libavcodec to decode the Opus Interactive Audio Codec. Requires the presence of the libopus headers and library during configuration. You need to explicitly configure the build with --enable-libopus.

An FFmpeg native decoder for Opus exists, so users can decode Opus without this library.

Subtitles Decoders
******************

libaribb24
==========

ARIB STD-B24 caption decoder.

Implements profiles A and C of the ARIB STD-B24 standard.

libaribb24 Decoder Options
--------------------------

-aribb24-base-path PATH
     Sets the base path for the libaribb24 library. This is utilized for reading of configuration files (for custom unicode conversions), and for dumping of non-text symbols as images under that location.

     Unset by default.

-aribb24-skip-ruby-text BOOLEAN
     Tells the decoder wrapper to skip text blocks that contain half-height ruby text.

     Enabled by default.

libaribcaption
==============

Yet another ARIB STD-B24 caption decoder using external libaribcaption library.

Implements profiles A and C of the Japanse ARIB STD-B24 standard, Brazilian ABNT NBR 15606-1, and Philippines version of ISDB-T.

Requires the presence of the libaribcaption headers and library (https://github.com/xqq/libaribcaption) during configuration. You need to explicitly configure the build with --enable-libaribcaption. If both libaribb24 and libaribcaption are enabled, libaribcaption decoder precedes.

libaribcaption Decoder Options
------------------------------

-sub_type SUBTITLE_TYPE
     Specifies the format of the decoded subtitles.

     bitmap
          Graphical image.

     ass
          ASS formatted text.

     text
          Simple text based output without formatting.

     The default is ass as same as libaribb24 decoder. Some present players (e.g., mpv) expect ASS format for ARIB caption.

-caption_encoding ENCODING_SCHEME
     Specifies the encoding scheme of input subtitle text.

     auto
          Automatically detect text encoding (default).

     jis
          8bit-char JIS encoding defined in ARIB STD B24. This encoding used in Japan for ISDB captions.

     utf8
          UTF-8 encoding defined in ARIB STD B24. This encoding is used in Philippines for ISDB-T captions.

     latin
          Latin character encoding defined in ABNT NBR 15606-1. This encoding is used in South America for SBTVD / ISDB-Tb captions.

-font FONT_NAME[,FONT_NAME2,...]
     Specify comma-separated list of font family names to be used for bitmap or ass type subtitle rendering. Only first font name is used for ass type subtitle.

     If not specified, use internaly defined default font family.

-ass_single_rect BOOLEAN
     ARIB STD-B24 specifies that some captions may be displayed at different positions at a time (multi-rectangle subtitle). Since some players (e.g., old mpv) can't handle multiple ASS rectangles in a single AVSubtitle, or multiple ASS rectangles of indeterminate duration with the same start timestamp, this option can change the behavior so that all the texts are displayed in a single ASS rectangle.

     The default is FALSE.

     If your player cannot handle AVSubtitles with multiple ASS rectangles properly, set this option to TRUE or define ASS_SINGLE_RECT=1 to change default behavior at compilation.

-force_outline_text BOOLEAN
     Specify whether always render outline text for all characters regardless of the indication by charactor style.

     The default is FALSE.

-outline_width NUMBER (0.0 - 3.0)
     Specify width for outline text, in dots (relative).

     The default is 1.5.

-ignore_background BOOLEAN
     Specify whether to ignore background color rendering.

     The default is FALSE.

-ignore_ruby BOOLEAN
     Specify whether to ignore rendering for ruby-like (furigana) characters.

     The default is FALSE.

-replace_drcs BOOLEAN
     Specify whether to render replaced DRCS characters as Unicode characters.

     The default is TRUE.

-replace_msz_ascii BOOLEAN
     Specify whether to replace MSZ (Middle Size; half width) fullwidth alphanumerics with halfwidth alphanumerics.

     The default is TRUE.

-replace_msz_japanese BOOLEAN
     Specify whether to replace some MSZ (Middle Size; half width) fullwidth japanese special characters with halfwidth ones.

     The default is TRUE.

-replace_msz_glyph BOOLEAN
     Specify whether to replace MSZ (Middle Size; half width) characters with halfwidth glyphs if the fonts supports it. This option works under FreeType or DirectWrite renderer with Adobe-Japan1 compliant fonts. e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho, Yu Gothic, Yu Mincho, and Meiryo.

     The default is TRUE.

-canvas_size IMAGE_SIZE
     Specify the resolution of the canvas to render subtitles to; usually, this should be frame size of input video. This only applies when -subtitle_type is set to BITMAP.

     The libaribcaption decoder assumes input frame size for bitmap rendering as below:

      1. PROFILE_A : 1440 x 1080 with SAR (PAR) 4:3

      2. PROFILE_C : 320 x 180 with SAR (PAR) 1:1

     If actual frame size of input video does not match above assumption, the rendered captions may be distorted. To make the captions undistorted, add -canvas_size option to specify actual input video size.

     Note that the -canvas_size option is not required for video with different size but same aspect ratio. In such cases, the caption will be stretched or shrunk to actual video size if -canvas_size option is not specified. If -canvas_size option is specified with different size, the caption will be stretched or shrunk as specified size with calculated SAR.

libaribcaption decoder usage examples
-------------------------------------

Display MPEG-TS file with ARIB subtitle by ffplay tool:

     ffplay -sub_type bitmap MPEG.TS

Display MPEG-TS file with input frame size 1920x1080 by ffplay tool:

     ffplay -sub_type bitmap -canvas_size 1920x1080 MPEG.TS

Embed ARIB subtitle in transcoded video:

     ffmpeg -sub_type bitmap -i src.m2t -filter_complex "[0:v][0:s]overlay" -vcodec h264 dest.mp4

dvbsub
======

Options
-------

compute_clut

     -2
          Compute clut once if no matching CLUT is in the stream.

     -1
          Compute clut if no matching CLUT is in the stream.

     0
          Never compute CLUT

     1
          Always compute CLUT and override the one provided in the stream.

dvb_substream
     Selects the dvb substream, or all substreams if -1 which is default.

dvdsub
======

This codec decodes the bitmap subtitles used in DVDs; the same subtitles can also be found in VobSub file pairs and in some Matroska files.

Options
-------

palette
     Specify the global palette used by the bitmaps. When stored in VobSub, the palette is normally specified in the index file; in Matroska, the palette is stored in the codec extra-data in the same format as in VobSub. In DVDs, the palette is stored in the IFO file, and therefore not available when reading from dumped VOB files.

     The format for this option is a string containing 16 24-bits hexadecimal numbers (without 0x prefix) separated by commas, for example 0d00ee, ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1, 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b.

ifo_palette
     Specify the IFO file from which the global palette is obtained. (experimental)

forced_subs_only
     Only decode subtitle entries marked as forced. Some titles have forced and non-forced subtitles in the same track. Setting this flag to 1 will only keep the forced subtitles. Default value is 0.

libzvbi-teletext
================

Libzvbi allows libavcodec to decode DVB teletext pages and DVB teletext subtitles. Requires the presence of the libzvbi headers and library during configuration. You need to explicitly configure the build with --enable-libzvbi.

Options
-------

txt_page
     List of teletext page numbers to decode. Pages that do not match the specified list are dropped. You may use the special * string to match all pages, or subtitle to match all subtitle pages. Default value is *.

txt_default_region
     Set default character set used for decoding, a value between 0 and 87 (see ETS 300 706, Section 15, Table 32). Default value is -1, which does not override the libzvbi default. This option is needed for some legacy level 1.0 transmissions which cannot signal the proper charset.

txt_chop_top
     Discards the top teletext line. Default value is 1.

txt_format
     Specifies the format of the decoded subtitles.

     bitmap
          The default format, you should use this for teletext pages, because certain graphics and colors cannot be expressed in simple text or even ASS.

     text
          Simple text based output without formatting.

     ass
          Formatted ASS output, subtitle pages and teletext pages are returned in different styles, subtitle pages are stripped down to text, but an effort is made to keep the text alignment and the formatting.

txt_left
     X offset of generated bitmaps, default is 0.

txt_top
     Y offset of generated bitmaps, default is 0.

txt_chop_spaces
     Chops leading and trailing spaces and removes empty lines from the generated text. This option is useful for teletext based subtitles where empty spaces may be present at the start or at the end of the lines or empty lines may be present between the subtitle lines because of double-sized teletext characters. Default value is 1.

txt_duration
     Sets the display duration of the decoded teletext pages or subtitles in milliseconds. Default value is -1 which means infinity or until the next subtitle event comes.

txt_transparent
     Force transparent background of the generated teletext bitmaps. Default value is 0 which means an opaque background.

txt_opacity
     Sets the opacity (0-255) of the teletext background. If txt_transparent is not set, it only affects characters between a start box and an end box, typically subtitles. Default value is 0 if txt_transparent is set, 255 otherwise.