ffprobe Documentation

Table of Contents

1 Synopsis

ffprobe [options] [input_file]

2 Description

ffprobe gathers information from multimedia streams and prints it in human- and machine-readable fashion.

For example it can be used to check the format of the container used by a multimedia stream and the format and type of each media stream contained in it.

If a filename is specified in input, ffprobe will try to open and probe the file content. If the file cannot be opened or recognized as a multimedia file, a positive exit code is returned.

ffprobe may be employed both as a standalone application or in combination with a textual filter, which may perform more sophisticated processing, e.g. statistical processing or plotting.

Options are used to list some of the formats supported by ffprobe or for specifying which information to display, and for setting how ffprobe will show it.

ffprobe output is designed to be easily parsable by a textual filter, and consists of one or more sections of a form defined by the selected writer, which is specified by the print_format option.

Sections may contain other nested sections, and are identified by a name (which may be shared by other sections), and an unique name. See the output of sections.

Metadata tags stored in the container or in the streams are recognized and printed in the corresponding "FORMAT", "STREAM" or "PROGRAM_STREAM" section.

3 Options

All the numerical options, if not specified otherwise, accept a string representing a number as input, which may be followed by one of the SI unit prefixes, for example: ’K’, ’M’, or ’G’.

If ’i’ is appended to the SI unit prefix, the complete prefix will be interpreted as a unit prefix for binary multiples, which are based on powers of 1024 instead of powers of 1000. Appending ’B’ to the SI unit prefix multiplies the value by 8. This allows using, for example: ’KB’, ’MiB’, ’G’ and ’B’ as number suffixes.

Options which do not take arguments are boolean options, and set the corresponding value to true. They can be set to false by prefixing the option name with "no". For example using "-nofoo" will set the boolean option with name "foo" to false.

3.1 Stream specifiers

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) a given option belongs to.

A stream specifier is a string generally appended to the option name and separated from it by a colon. E.g. -codec:a:1 ac3 contains the a:1 stream specifier, which matches the second audio stream. Therefore, it would select the ac3 codec for the second audio stream.

A stream specifier can match several streams, so that the option is applied to all of them. E.g. the stream specifier in -b:a 128k matches all audio streams.

An empty stream specifier matches all streams. For example, -codec copy or -codec: copy would copy all the streams without reencoding.

Possible forms of stream specifiers are:

stream_index

Matches the stream with this index. E.g. -threads:1 4 would set the thread count for the second stream to 4.

stream_type[:stream_index]

stream_type is one of following: ’v’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. If stream_index is given, then it matches stream number stream_index of this type. Otherwise, it matches all streams of this type.

p:program_id[:stream_index]

If stream_index is given, then it matches the stream with number stream_index in the program with the id program_id. Otherwise, it matches all streams in the program.

#stream_id or i:stream_id

Match the stream by stream id (e.g. PID in MPEG-TS container).

m:key[:value]

Matches streams with the metadata tag key having the specified value. If value is not given, matches streams that contain the given tag with any value.

u

Matches streams with usable configuration, the codec must be defined and the essential information such as video dimension or audio sample rate must be present.

Note that in ffmpeg, matching by metadata will only work properly for input files.

3.2 Generic options

These options are shared amongst the ff* tools.

-L

Show license.

-h, -?, -help, --help [arg]

Show help. An optional parameter may be specified to print help about a specific item. If no argument is specified, only basic (non advanced) tool options are shown.

Possible values of arg are:

long

Print advanced tool options in addition to the basic tool options.

full

Print complete list of options, including shared and private options for encoders, decoders, demuxers, muxers, filters, etc.

decoder=decoder_name

Print detailed information about the decoder named decoder_name. Use the -decoders option to get a list of all decoders.

encoder=encoder_name

Print detailed information about the encoder named encoder_name. Use the -encoders option to get a list of all encoders.

demuxer=demuxer_name

Print detailed information about the demuxer named demuxer_name. Use the -formats option to get a list of all demuxers and muxers.

muxer=muxer_name

Print detailed information about the muxer named muxer_name. Use the -formats option to get a list of all muxers and demuxers.

filter=filter_name

Print detailed information about the filter name filter_name. Use the -filters option to get a list of all filters.

-version

Show version.

-formats

Show available formats (including devices).

-devices

Show available devices.

-codecs

Show all codecs known to libavcodec.

Note that the term ’codec’ is used throughout this documentation as a shortcut for what is more correctly called a media bitstream format.

-decoders

Show available decoders.

-encoders

Show all available encoders.

-bsfs

Show available bitstream filters.

-protocols

Show available protocols.

-filters

Show available libavfilter filters.

-pix_fmts

Show available pixel formats.

-sample_fmts

Show available sample formats.

-layouts

Show channel names and standard channel layouts.

-colors

Show recognized color names.

-sources device[,opt1=val1[,opt2=val2]...]

Show autodetected sources of the intput device. Some devices may provide system-dependent source names that cannot be autodetected. The returned list cannot be assumed to be always complete.

ffmpeg -sources pulse,server=192.168.0.4
-sinks device[,opt1=val1[,opt2=val2]...]

Show autodetected sinks of the output device. Some devices may provide system-dependent sink names that cannot be autodetected. The returned list cannot be assumed to be always complete.

ffmpeg -sinks pulse,server=192.168.0.4
-loglevel [repeat+]loglevel | -v [repeat+]loglevel

Set the logging level used by the library. Adding "repeat+" indicates that repeated log output should not be compressed to the first line and the "Last message repeated n times" line will be omitted. "repeat" can also be used alone. If "repeat" is used alone, and with no prior loglevel set, the default loglevel will be used. If multiple loglevel parameters are given, using ’repeat’ will not change the loglevel. loglevel is a string or a number containing one of the following values:

quiet, -8

Show nothing at all; be silent.

panic, 0

Only show fatal errors which could lead the process to crash, such as and assert failure. This is not currently used for anything.

fatal, 8

Only show fatal errors. These are errors after which the process absolutely cannot continue after.

error, 16

Show all errors, including ones which can be recovered from.

warning, 24

Show all warnings and errors. Any message related to possibly incorrect or unexpected events will be shown.

info, 32

Show informative messages during processing. This is in addition to warnings and errors. This is the default value.

verbose, 40

Same as info, except more verbose.

debug, 48

Show everything, including debugging information.

trace, 56

By default the program logs to stderr, if coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable AV_LOG_FORCE_NOCOLOR or NO_COLOR, or can be forced setting the environment variable AV_LOG_FORCE_COLOR. The use of the environment variable NO_COLOR is deprecated and will be dropped in a following FFmpeg version.

-report

Dump full command line and console output to a file named program-YYYYMMDD-HHMMSS.log in the current directory. This file can be useful for bug reports. It also implies -loglevel verbose.

Setting the environment variable FFREPORT to any value has the same effect. If the value is a ’:’-separated key=value sequence, these options will affect the report; option values must be escaped if they contain special characters or the options delimiter ’:’ (see the “Quoting and escaping” section in the ffmpeg-utils manual).

The following options are recognized:

file

set the file name to use for the report; %p is expanded to the name of the program, %t is expanded to a timestamp, %% is expanded to a plain %

level

set the log verbosity level using a numerical value (see -loglevel).

For example, to output a report to a file named ffreport.log using a log level of 32 (alias for log level info):

FFREPORT=file=ffreport.log:level=32 ffmpeg -i input output

Errors in parsing the environment variable are not fatal, and will not appear in the report.

-hide_banner

Suppress printing banner.

All FFmpeg tools will normally show a copyright notice, build options and library versions. This option can be used to suppress printing this information.

-cpuflags flags (global)

Allows setting and clearing cpu flags. This option is intended for testing. Do not use it unless you know what you’re doing.

ffmpeg -cpuflags -sse+mmx ...
ffmpeg -cpuflags mmx ...
ffmpeg -cpuflags 0 ...

Possible flags for this option are:

x86
mmx
mmxext
sse
sse2
sse2slow
sse3
sse3slow
ssse3
atom
sse4.1
sse4.2
avx
avx2
xop
fma3
fma4
3dnow
3dnowext
bmi1
bmi2
cmov
ARM
armv5te
armv6
armv6t2
vfp
vfpv3
neon
setend
AArch64
armv8
vfp
neon
PowerPC
altivec
Specific Processors
pentium2
pentium3
pentium4
k6
k62
athlon
athlonxp
k8
-opencl_bench

This option is used to benchmark all available OpenCL devices and print the results. This option is only available when FFmpeg has been compiled with --enable-opencl.

When FFmpeg is configured with --enable-opencl, the options for the global OpenCL context are set via -opencl_options. See the "OpenCL Options" section in the ffmpeg-utils manual for the complete list of supported options. Amongst others, these options include the ability to select a specific platform and device to run the OpenCL code on. By default, FFmpeg will run on the first device of the first platform. While the options for the global OpenCL context provide flexibility to the user in selecting the OpenCL device of their choice, most users would probably want to select the fastest OpenCL device for their system.

This option assists the selection of the most efficient configuration by identifying the appropriate device for the user’s system. The built-in benchmark is run on all the OpenCL devices and the performance is measured for each device. The devices in the results list are sorted based on their performance with the fastest device listed first. The user can subsequently invoke ffmpeg using the device deemed most appropriate via -opencl_options to obtain the best performance for the OpenCL accelerated code.

Typical usage to use the fastest OpenCL device involve the following steps.

Run the command:

ffmpeg -opencl_bench

Note down the platform ID (pidx) and device ID (didx) of the first i.e. fastest device in the list. Select the platform and device using the command:

ffmpeg -opencl_options platform_idx=pidx:device_idx=didx ...
-opencl_options options (global)

Set OpenCL environment options. This option is only available when FFmpeg has been compiled with --enable-opencl.

options must be a list of key=value option pairs separated by ’:’. See the “OpenCL Options” section in the ffmpeg-utils manual for the list of supported options.

3.3 AVOptions

These options are provided directly by the libavformat, libavdevice and libavcodec libraries. To see the list of available AVOptions, use the -help option. They are separated into two categories:

generic

These options can be set for any container, codec or device. Generic options are listed under AVFormatContext options for containers/devices and under AVCodecContext options for codecs.

private

These options are specific to the given container, device or codec. Private options are listed under their corresponding containers/devices/codecs.

For example to write an ID3v2.3 header instead of a default ID3v2.4 to an MP3 file, use the id3v2_version private option of the MP3 muxer:

ffmpeg -i input.flac -id3v2_version 3 out.mp3

All codec AVOptions are per-stream, and thus a stream specifier should be attached to them.

Note: the -nooption syntax cannot be used for boolean AVOptions, use -option 0/-option 1.

Note: the old undocumented way of specifying per-stream AVOptions by prepending v/a/s to the options name is now obsolete and will be removed soon.

3.4 Main options

-f format

Force format to use.

-unit

Show the unit of the displayed values.

-prefix

Use SI prefixes for the displayed values. Unless the "-byte_binary_prefix" option is used all the prefixes are decimal.

-byte_binary_prefix

Force the use of binary prefixes for byte values.

-sexagesimal

Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.

-pretty

Prettify the format of the displayed values, it corresponds to the options "-unit -prefix -byte_binary_prefix -sexagesimal".

-of, -print_format writer_name[=writer_options]

Set the output printing format.

writer_name specifies the name of the writer, and writer_options specifies the options to be passed to the writer.

For example for printing the output in JSON format, specify:

-print_format json

For more details on the available output printing formats, see the Writers section below.

-sections

Print sections structure and section information, and exit. The output is not meant to be parsed by a machine.

-select_streams stream_specifier

Select only the streams specified by stream_specifier. This option affects only the options related to streams (e.g. show_streams, show_packets, etc.).

For example to show only audio streams, you can use the command:

ffprobe -show_streams -select_streams a INPUT

To show only video packets belonging to the video stream with index 1:

ffprobe -show_packets -select_streams v:1 INPUT
-show_data

Show payload data, as a hexadecimal and ASCII dump. Coupled with -show_packets, it will dump the packets’ data. Coupled with -show_streams, it will dump the codec extradata.

The dump is printed as the "data" field. It may contain newlines.

-show_data_hash algorithm

Show a hash of payload data, for packets with -show_packets and for codec extradata with -show_streams.

-show_error

Show information about the error found when trying to probe the input.

The error information is printed within a section with name "ERROR".

-show_format

Show information about the container format of the input multimedia stream.

All the container format information is printed within a section with name "FORMAT".

-show_format_entry name

Like -show_format, but only prints the specified entry of the container format information, rather than all. This option may be given more than once, then all specified entries will be shown.

This option is deprecated, use show_entries instead.

-show_entries section_entries

Set list of entries to show.

Entries are specified according to the following syntax. section_entries contains a list of section entries separated by :. Each section entry is composed by a section name (or unique name), optionally followed by a list of entries local to that section, separated by ,.

If section name is specified but is followed by no =, all entries are printed to output, together with all the contained sections. Otherwise only the entries specified in the local section entries list are printed. In particular, if = is specified but the list of local entries is empty, then no entries will be shown for that section.

Note that the order of specification of the local section entries is not honored in the output, and the usual display order will be retained.

The formal syntax is given by:

LOCAL_SECTION_ENTRIES ::= SECTION_ENTRY_NAME[,LOCAL_SECTION_ENTRIES]
SECTION_ENTRY         ::= SECTION_NAME[=[LOCAL_SECTION_ENTRIES]]
SECTION_ENTRIES       ::= SECTION_ENTRY[:SECTION_ENTRIES]

For example, to show only the index and type of each stream, and the PTS time, duration time, and stream index of the packets, you can specify the argument:

packet=pts_time,duration_time,stream_index : stream=index,codec_type

To show all the entries in the section "format", but only the codec type in the section "stream", specify the argument:

format : stream=codec_type

To show all the tags in the stream and format sections:

stream_tags : format_tags

To show only the title tag (if available) in the stream sections:

stream_tags=title
-show_packets

Show information about each packet contained in the input multimedia stream.

The information for each single packet is printed within a dedicated section with name "PACKET".

-show_frames

Show information about each frame and subtitle contained in the input multimedia stream.

The information for each single frame is printed within a dedicated section with name "FRAME" or "SUBTITLE".

-show_streams

Show information about each media stream contained in the input multimedia stream.

Each media stream information is printed within a dedicated section with name "STREAM".

-show_programs

Show information about programs and their streams contained in the input multimedia stream.

Each media stream information is printed within a dedicated section with name "PROGRAM_STREAM".

-show_chapters

Show information about chapters stored in the format.

Each chapter is printed within a dedicated section with name "CHAPTER".

-count_frames

Count the number of frames per stream and report it in the corresponding stream section.

-count_packets

Count the number of packets per stream and report it in the corresponding stream section.

-read_intervals read_intervals

Read only the specified intervals. read_intervals must be a sequence of interval specifications separated by ",". ffprobe will seek to the interval starting point, and will continue reading from that.

Each interval is specified by two optional parts, separated by "%".

The first part specifies the interval start position. It is interpreted as an abolute position, or as a relative offset from the current position if it is preceded by the "+" character. If this first part is not specified, no seeking will be performed when reading this interval.

The second part specifies the interval end position. It is interpreted as an absolute position, or as a relative offset from the current position if it is preceded by the "+" character. If the offset specification starts with "#", it is interpreted as the number of packets to read (not including the flushing packets) from the interval start. If no second part is specified, the program will read until the end of the input.

Note that seeking is not accurate, thus the actual interval start point may be different from the specified position. Also, when an interval duration is specified, the absolute end time will be computed by adding the duration to the interval start point found by seeking the file, rather than to the specified start value.

The formal syntax is given by:

INTERVAL  ::= [START|+START_OFFSET][%[END|+END_OFFSET]]
INTERVALS ::= INTERVAL[,INTERVALS]

A few examples follow.

  • Seek to time 10, read packets until 20 seconds after the found seek point, then seek to position 01:30 (1 minute and thirty seconds) and read packets until position 01:45.
    10%+20,01:30%01:45
    
  • Read only 42 packets after seeking to position 01:23:
    01:23%+#42
    
  • Read only the first 20 seconds from the start:
    %+20
    
  • Read from the start until position 02:30:
    %02:30
    
-show_private_data, -private

Show private data, that is data depending on the format of the particular shown element. This option is enabled by default, but you may need to disable it for specific uses, for example when creating XSD-compliant XML output.

-show_program_version

Show information related to program version.

Version information is printed within a section with name "PROGRAM_VERSION".

-show_library_versions

Show information related to library versions.

Version information for each library is printed within a section with name "LIBRARY_VERSION".

-show_versions

Show information related to program and library versions. This is the equivalent of setting both -show_program_version and -show_library_versions options.

-show_pixel_formats

Show information about all pixel formats supported by FFmpeg.

Pixel format information for each format is printed within a section with name "PIXEL_FORMAT".

-bitexact

Force bitexact output, useful to produce output which is not dependent on the specific build.

-i input_file

Read input_file.

4 Writers

A writer defines the output format adopted by ffprobe, and will be used for printing all the parts of the output.

A writer may accept one or more arguments, which specify the options to adopt. The options are specified as a list of key=value pairs, separated by ":".

All writers support the following options:

string_validation, sv

Set string validation mode.

The following values are accepted.

fail

The writer will fail immediately in case an invalid string (UTF-8) sequence or code point is found in the input. This is especially useful to validate input metadata.

ignore

Any validation error will be ignored. This will result in possibly broken output, especially with the json or xml writer.

replace

The writer will substitute invalid UTF-8 sequences or code points with the string specified with the string_validation_replacement.

Default value is ‘replace’.

string_validation_replacement, svr

Set replacement string to use in case string_validation is set to ‘replace’.

In case the option is not specified, the writer will assume the empty string, that is it will remove the invalid sequences from the input strings.

A description of the currently available writers follows.

4.1 default

Default format.

Print each section in the form:

[SECTION]
key1=val1
...
keyN=valN
[/SECTION]

Metadata tags are printed as a line in the corresponding FORMAT, STREAM or PROGRAM_STREAM section, and are prefixed by the string "TAG:".

A description of the accepted options follows.

nokey, nk

If set to 1 specify not to print the key of each field. Default value is 0.

noprint_wrappers, nw

If set to 1 specify not to print the section header and footer. Default value is 0.

4.2 compact, csv

Compact and CSV format.

The csv writer is equivalent to compact, but supports different defaults.

Each section is printed on a single line. If no option is specifid, the output has the form:

section|key1=val1| ... |keyN=valN

Metadata tags are printed in the corresponding "format" or "stream" section. A metadata tag key, if printed, is prefixed by the string "tag:".

The description of the accepted options follows.

item_sep, s

Specify the character to use for separating fields in the output line. It must be a single printable character, it is "|" by default ("," for the csv writer).

nokey, nk

If set to 1 specify not to print the key of each field. Its default value is 0 (1 for the csv writer).

escape, e

Set the escape mode to use, default to "c" ("csv" for the csv writer).

It can assume one of the following values:

c

Perform C-like escaping. Strings containing a newline (‘\n’), carriage return (‘\r’), a tab (‘\t’), a form feed (‘\f’), the escaping character (‘\’) or the item separator character SEP are escaped using C-like fashioned escaping, so that a newline is converted to the sequence ‘\n’, a carriage return to ‘\r’, ‘\’ to ‘\\’ and the separator SEP is converted to ‘\SEP’.

csv

Perform CSV-like escaping, as described in RFC4180. Strings containing a newline (‘\n’), a carriage return (‘\r’), a double quote (‘"’), or SEP are enclosed in double-quotes.

none

Perform no escaping.

print_section, p

Print the section name at the begin of each line if the value is 1, disable it with value set to 0. Default value is 1.

4.3 flat

Flat format.

A free-form output where each line contains an explicit key=value, such as "streams.stream.3.tags.foo=bar". The output is shell escaped, so it can be directly embedded in sh scripts as long as the separator character is an alphanumeric character or an underscore (see sep_char option).

The description of the accepted options follows.

sep_char, s

Separator character used to separate the chapter, the section name, IDs and potential tags in the printed field key.

Default value is ‘.’.

hierarchical, h

Specify if the section name specification should be hierarchical. If set to 1, and if there is more than one section in the current chapter, the section name will be prefixed by the name of the chapter. A value of 0 will disable this behavior.

Default value is 1.

4.4 ini

INI format output.

Print output in an INI based format.

The following conventions are adopted:

This writer accepts options as a list of key=value pairs, separated by ‘:’.

The description of the accepted options follows.

hierarchical, h

Specify if the section name specification should be hierarchical. If set to 1, and if there is more than one section in the current chapter, the section name will be prefixed by the name of the chapter. A value of 0 will disable this behavior.

Default value is 1.

4.5 json

JSON based format.

Each section is printed using JSON notation.

The description of the accepted options follows.

compact, c

If set to 1 enable compact output, that is each section will be printed on a single line. Default value is 0.

For more information about JSON, see http://www.json.org/.

4.6 xml

XML based format.

The XML output is described in the XML schema description file ffprobe.xsd installed in the FFmpeg datadir.

An updated version of the schema can be retrieved at the url http://www.ffmpeg.org/schema/ffprobe.xsd, which redirects to the latest schema committed into the FFmpeg development source code tree.

Note that the output issued will be compliant to the ffprobe.xsd schema only when no special global output options (unit, prefix, byte_binary_prefix, sexagesimal etc.) are specified.

The description of the accepted options follows.

fully_qualified, q

If set to 1 specify if the output should be fully qualified. Default value is 0. This is required for generating an XML file which can be validated through an XSD file.

xsd_compliant, x

If set to 1 perform more checks for ensuring that the output is XSD compliant. Default value is 0. This option automatically sets fully_qualified to 1.

For more information about the XML format, see http://www.w3.org/XML/.

5 Timecode

ffprobe supports Timecode extraction:

6 Syntax

This section documents the syntax and formats employed by the FFmpeg libraries and tools.

6.1 Quoting and escaping

FFmpeg adopts the following quoting and escaping mechanism, unless explicitly specified. The following rules are applied:

Note that you may need to add a second level of escaping when using the command line or a script, which depends on the syntax of the adopted shell language.

The function av_get_token defined in libavutil/avstring.h can be used to parse a token quoted or escaped according to the rules defined above.

The tool tools/ffescape in the FFmpeg source tree can be used to automatically quote or escape a string in a script.

6.1.1 Examples

6.2 Date

The accepted syntax is:

[(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z]
now

If the value is "now" it takes the current time.

Time is local time unless Z is appended, in which case it is interpreted as UTC. If the year-month-day part is not specified it takes the current year-month-day.

6.3 Time duration

There are two accepted syntaxes for expressing time duration.

[-][HH:]MM:SS[.m...]

HH expresses the number of hours, MM the number of minutes for a maximum of 2 digits, and SS the number of seconds for a maximum of 2 digits. The m at the end expresses decimal value for SS.

or

[-]S+[.m...]

S expresses the number of seconds, with the optional decimal part m.

In both expressions, the optional ‘-’ indicates negative duration.

6.3.1 Examples

The following examples are all valid time duration:

55

55 seconds

12:03:45

12 hours, 03 minutes and 45 seconds

23.189

23.189 seconds

6.4 Video size

Specify the size of the sourced video, it may be a string of the form widthxheight, or the name of a size abbreviation.

The following abbreviations are recognized:

ntsc

720x480

pal

720x576

qntsc

352x240

qpal

352x288

sntsc

640x480

spal

768x576

film

352x240

ntsc-film

352x240

sqcif

128x96

qcif

176x144

cif

352x288

4cif

704x576

16cif

1408x1152

qqvga

160x120

qvga

320x240

vga

640x480

svga

800x600

xga

1024x768

uxga

1600x1200

qxga

2048x1536

sxga

1280x1024

qsxga

2560x2048

hsxga

5120x4096

wvga

852x480

wxga

1366x768

wsxga

1600x1024

wuxga

1920x1200

woxga

2560x1600

wqsxga

3200x2048

wquxga

3840x2400

whsxga

6400x4096

whuxga

7680x4800

cga

320x200

ega

640x350

hd480

852x480

hd720

1280x720

hd1080

1920x1080

2k

2048x1080

2kflat

1998x1080

2kscope

2048x858

4k

4096x2160

4kflat

3996x2160

4kscope

4096x1716

nhd

640x360

hqvga

240x160

wqvga

400x240

fwqvga

432x240

hvga

480x320

qhd

960x540

6.5 Video rate

Specify the frame rate of a video, expressed as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a float number or a valid video frame rate abbreviation.

The following abbreviations are recognized:

ntsc

30000/1001

pal

25/1

qntsc

30000/1001

qpal

25/1

sntsc

30000/1001

spal

25/1

film

24/1

ntsc-film

24000/1001

6.6 Ratio

A ratio can be expressed as an expression, or in the form numerator:denominator.

Note that a ratio with infinite (1/0) or negative value is considered valid, so you should check on the returned value if you want to exclude those values.

The undefined value can be expressed using the "0:0" string.

6.7 Color

It can be the name of a color as defined below (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, possibly followed by @ and a string representing the alpha component.

The alpha component may be a string composed by "0x" followed by an hexadecimal number or a decimal number between 0.0 and 1.0, which represents the opacity value (‘0x00’ or ‘0.0’ means completely transparent, ‘0xff’ or ‘1.0’ completely opaque). If the alpha component is not specified then ‘0xff’ is assumed.

The string ‘random’ will result in a random color.

The following names of colors are recognized:

AliceBlue

0xF0F8FF

AntiqueWhite

0xFAEBD7

Aqua

0x00FFFF

Aquamarine

0x7FFFD4

Azure

0xF0FFFF

Beige

0xF5F5DC

Bisque

0xFFE4C4

Black

0x000000

BlanchedAlmond

0xFFEBCD

Blue

0x0000FF

BlueViolet

0x8A2BE2

Brown

0xA52A2A

BurlyWood

0xDEB887

CadetBlue

0x5F9EA0

Chartreuse

0x7FFF00

Chocolate

0xD2691E

Coral

0xFF7F50

CornflowerBlue

0x6495ED

Cornsilk

0xFFF8DC

Crimson

0xDC143C

Cyan

0x00FFFF

DarkBlue

0x00008B

DarkCyan

0x008B8B

DarkGoldenRod

0xB8860B

DarkGray

0xA9A9A9

DarkGreen

0x006400

DarkKhaki

0xBDB76B

DarkMagenta

0x8B008B

DarkOliveGreen

0x556B2F

Darkorange

0xFF8C00

DarkOrchid

0x9932CC

DarkRed

0x8B0000

DarkSalmon

0xE9967A

DarkSeaGreen

0x8FBC8F

DarkSlateBlue

0x483D8B

DarkSlateGray

0x2F4F4F

DarkTurquoise

0x00CED1

DarkViolet

0x9400D3

DeepPink

0xFF1493

DeepSkyBlue

0x00BFFF

DimGray

0x696969

DodgerBlue

0x1E90FF

FireBrick

0xB22222

FloralWhite

0xFFFAF0

ForestGreen

0x228B22

Fuchsia

0xFF00FF

Gainsboro

0xDCDCDC

GhostWhite

0xF8F8FF

Gold

0xFFD700

GoldenRod

0xDAA520

Gray

0x808080

Green

0x008000

GreenYellow

0xADFF2F

HoneyDew

0xF0FFF0

HotPink

0xFF69B4

IndianRed

0xCD5C5C

Indigo

0x4B0082

Ivory

0xFFFFF0

Khaki

0xF0E68C

Lavender

0xE6E6FA

LavenderBlush

0xFFF0F5

LawnGreen

0x7CFC00

LemonChiffon

0xFFFACD

LightBlue

0xADD8E6

LightCoral

0xF08080

LightCyan

0xE0FFFF

LightGoldenRodYellow

0xFAFAD2

LightGreen

0x90EE90

LightGrey

0xD3D3D3

LightPink

0xFFB6C1

LightSalmon

0xFFA07A

LightSeaGreen

0x20B2AA

LightSkyBlue

0x87CEFA

LightSlateGray

0x778899

LightSteelBlue

0xB0C4DE

LightYellow

0xFFFFE0

Lime

0x00FF00

LimeGreen

0x32CD32

Linen

0xFAF0E6

Magenta

0xFF00FF

Maroon

0x800000

MediumAquaMarine

0x66CDAA

MediumBlue

0x0000CD

MediumOrchid

0xBA55D3

MediumPurple

0x9370D8

MediumSeaGreen

0x3CB371

MediumSlateBlue

0x7B68EE

MediumSpringGreen

0x00FA9A

MediumTurquoise

0x48D1CC

MediumVioletRed

0xC71585

MidnightBlue

0x191970

MintCream

0xF5FFFA

MistyRose

0xFFE4E1

Moccasin

0xFFE4B5

NavajoWhite

0xFFDEAD

Navy

0x000080

OldLace

0xFDF5E6

Olive

0x808000

OliveDrab

0x6B8E23

Orange

0xFFA500

OrangeRed

0xFF4500

Orchid

0xDA70D6

PaleGoldenRod

0xEEE8AA

PaleGreen

0x98FB98

PaleTurquoise

0xAFEEEE

PaleVioletRed

0xD87093

PapayaWhip

0xFFEFD5

PeachPuff

0xFFDAB9

Peru

0xCD853F

Pink

0xFFC0CB

Plum

0xDDA0DD

PowderBlue

0xB0E0E6

Purple

0x800080

Red

0xFF0000

RosyBrown

0xBC8F8F

RoyalBlue

0x4169E1

SaddleBrown

0x8B4513

Salmon

0xFA8072

SandyBrown

0xF4A460

SeaGreen

0x2E8B57

SeaShell

0xFFF5EE

Sienna

0xA0522D

Silver

0xC0C0C0

SkyBlue

0x87CEEB

SlateBlue

0x6A5ACD

SlateGray

0x708090

Snow

0xFFFAFA

SpringGreen

0x00FF7F

SteelBlue

0x4682B4

Tan

0xD2B48C

Teal

0x008080

Thistle

0xD8BFD8

Tomato

0xFF6347

Turquoise

0x40E0D0

Violet

0xEE82EE

Wheat

0xF5DEB3

White

0xFFFFFF

WhiteSmoke

0xF5F5F5

Yellow

0xFFFF00

YellowGreen

0x9ACD32

6.8 Channel Layout

A channel layout specifies the spatial disposition of the channels in a multi-channel audio stream. To specify a channel layout, FFmpeg makes use of a special syntax.

Individual channels are identified by an id, as given by the table below:

FL

front left

FR

front right

FC

front center

LFE

low frequency

BL

back left

BR

back right

FLC

front left-of-center

FRC

front right-of-center

BC

back center

SL

side left

SR

side right

TC

top center

TFL

top front left

TFC

top front center

TFR

top front right

TBL

top back left

TBC

top back center

TBR

top back right

DL

downmix left

DR

downmix right

WL

wide left

WR

wide right

SDL

surround direct left

SDR

surround direct right

LFE2

low frequency 2

Standard channel layout compositions can be specified by using the following identifiers:

mono

FC

stereo

FL+FR

2.1

FL+FR+LFE

3.0

FL+FR+FC

3.0(back)

FL+FR+BC

4.0

FL+FR+FC+BC

quad

FL+FR+BL+BR

quad(side)

FL+FR+SL+SR

3.1

FL+FR+FC+LFE

5.0

FL+FR+FC+BL+BR

5.0(side)

FL+FR+FC+SL+SR

4.1

FL+FR+FC+LFE+BC

5.1

FL+FR+FC+LFE+BL+BR

5.1(side)

FL+FR+FC+LFE+SL+SR

6.0

FL+FR+FC+BC+SL+SR

6.0(front)

FL+FR+FLC+FRC+SL+SR

hexagonal

FL+FR+FC+BL+BR+BC

6.1

FL+FR+FC+LFE+BC+SL+SR

6.1

FL+FR+FC+LFE+BL+BR+BC

6.1(front)

FL+FR+LFE+FLC+FRC+SL+SR

7.0

FL+FR+FC+BL+BR+SL+SR

7.0(front)

FL+FR+FC+FLC+FRC+SL+SR

7.1

FL+FR+FC+LFE+BL+BR+SL+SR

7.1(wide)

FL+FR+FC+LFE+BL+BR+FLC+FRC

7.1(wide-side)

FL+FR+FC+LFE+FLC+FRC+SL+SR

octagonal

FL+FR+FC+BL+BR+BC+SL+SR

downmix

DL+DR

A custom channel layout can be specified as a sequence of terms, separated by ’+’ or ’|’. Each term can be:

Starting from libavutil version 53 the trailing character "c" to specify a number of channels will be required, while a channel layout mask could also be specified as a decimal number (if and only if not followed by "c").

See also the function av_get_channel_layout defined in libavutil/channel_layout.h.

7 Expression Evaluation

When evaluating an arithmetic expression, FFmpeg uses an internal formula evaluator, implemented through the libavutil/eval.h interface.

An expression may contain unary, binary operators, constants, and functions.

Two expressions expr1 and expr2 can be combined to form another expression "expr1;expr2". expr1 and expr2 are evaluated in turn, and the new expression evaluates to the value of expr2.

The following binary operators are available: +, -, *, /, ^.

The following unary operators are available: +, -.

The following functions are available:

abs(x)

Compute absolute value of x.

acos(x)

Compute arccosine of x.

asin(x)

Compute arcsine of x.

atan(x)

Compute arctangent of x.

between(x, min, max)

Return 1 if x is greater than or equal to min and lesser than or equal to max, 0 otherwise.

bitand(x, y)
bitor(x, y)

Compute bitwise and/or operation on x and y.

The results of the evaluation of x and y are converted to integers before executing the bitwise operation.

Note that both the conversion to integer and the conversion back to floating point can lose precision. Beware of unexpected results for large numbers (usually 2^53 and larger).

ceil(expr)

Round the value of expression expr upwards to the nearest integer. For example, "ceil(1.5)" is "2.0".

clip(x, min, max)

Return the value of x clipped between min and max.

cos(x)

Compute cosine of x.

cosh(x)

Compute hyperbolic cosine of x.

eq(x, y)

Return 1 if x and y are equivalent, 0 otherwise.

exp(x)

Compute exponential of x (with base e, the Euler’s number).

floor(expr)

Round the value of expression expr downwards to the nearest integer. For example, "floor(-1.5)" is "-2.0".

gauss(x)

Compute Gauss function of x, corresponding to exp(-x*x/2) / sqrt(2*PI).

gcd(x, y)

Return the greatest common divisor of x and y. If both x and y are 0 or either or both are less than zero then behavior is undefined.

gt(x, y)

Return 1 if x is greater than y, 0 otherwise.

gte(x, y)

Return 1 if x is greater than or equal to y, 0 otherwise.

hypot(x, y)

This function is similar to the C function with the same name; it returns "sqrt(x*x + y*y)", the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin.

if(x, y)

Evaluate x, and if the result is non-zero return the result of the evaluation of y, return 0 otherwise.

if(x, y, z)

Evaluate x, and if the result is non-zero return the evaluation result of y, otherwise the evaluation result of z.

ifnot(x, y)

Evaluate x, and if the result is zero return the result of the evaluation of y, return 0 otherwise.

ifnot(x, y, z)

Evaluate x, and if the result is zero return the evaluation result of y, otherwise the evaluation result of z.

isinf(x)

Return 1.0 if x is +/-INFINITY, 0.0 otherwise.

isnan(x)

Return 1.0 if x is NAN, 0.0 otherwise.

ld(var)

Load the value of the internal variable with number var, which was previously stored with st(var, expr). The function returns the loaded value.

log(x)

Compute natural logarithm of x.

lt(x, y)

Return 1 if x is lesser than y, 0 otherwise.

lte(x, y)

Return 1 if x is lesser than or equal to y, 0 otherwise.

max(x, y)

Return the maximum between x and y.

min(x, y)

Return the maximum between x and y.

mod(x, y)

Compute the remainder of division of x by y.

not(expr)

Return 1.0 if expr is zero, 0.0 otherwise.

pow(x, y)

Compute the power of x elevated y, it is equivalent to "(x)^(y)".

print(t)
print(t, l)

Print the value of expression t with loglevel l. If l is not specified then a default log level is used. Returns the value of the expression printed.

Prints t with loglevel l

random(x)

Return a pseudo random value between 0.0 and 1.0. x is the index of the internal variable which will be used to save the seed/state.

root(expr, max)

Find an input value for which the function represented by expr with argument ld(0) is 0 in the interval 0..max.

The expression in expr must denote a continuous function or the result is undefined.

ld(0) is used to represent the function input value, which means that the given expression will be evaluated multiple times with various input values that the expression can access through ld(0). When the expression evaluates to 0 then the corresponding input value will be returned.

sin(x)

Compute sine of x.

sinh(x)

Compute hyperbolic sine of x.

sqrt(expr)

Compute the square root of expr. This is equivalent to "(expr)^.5".

squish(x)

Compute expression 1/(1 + exp(4*x)).

st(var, expr)

Store the value of the expression expr in an internal variable. var specifies the number of the variable where to store the value, and it is a value ranging from 0 to 9. The function returns the value stored in the internal variable. Note, Variables are currently not shared between expressions.

tan(x)

Compute tangent of x.

tanh(x)

Compute hyperbolic tangent of x.

taylor(expr, x)
taylor(expr, x, id)

Evaluate a Taylor series at x, given an expression representing the ld(id)-th derivative of a function at 0.

When the series does not converge the result is undefined.

ld(id) is used to represent the derivative order in expr, which means that the given expression will be evaluated multiple times with various input values that the expression can access through ld(id). If id is not specified then 0 is assumed.

Note, when you have the derivatives at y instead of 0, taylor(expr, x-y) can be used.

time(0)

Return the current (wallclock) time in seconds.

trunc(expr)

Round the value of expression expr towards zero to the nearest integer. For example, "trunc(-1.5)" is "-1.0".

while(cond, expr)

Evaluate expression expr while the expression cond is non-zero, and returns the value of the last expr evaluation, or NAN if cond was always false.

The following constants are available:

PI

area of the unit disc, approximately 3.14

E

exp(1) (Euler’s number), approximately 2.718

PHI

golden ratio (1+sqrt(5))/2, approximately 1.618

Assuming that an expression is considered "true" if it has a non-zero value, note that:

* works like AND

+ works like OR

For example the construct:

if (A AND B) then C

is equivalent to:

if(A*B, C)

In your C code, you can extend the list of unary and binary functions, and define recognized constants, so that they are available for your expressions.

The evaluator also recognizes the International System unit prefixes. If ’i’ is appended after the prefix, binary prefixes are used, which are based on powers of 1024 instead of powers of 1000. The ’B’ postfix multiplies the value by 8, and can be appended after a unit prefix or used alone. This allows using for example ’KB’, ’MiB’, ’G’ and ’B’ as number postfix.

The list of available International System prefixes follows, with indication of the corresponding powers of 10 and of 2.

y

10^-24 / 2^-80

z

10^-21 / 2^-70

a

10^-18 / 2^-60

f

10^-15 / 2^-50

p

10^-12 / 2^-40

n

10^-9 / 2^-30

u

10^-6 / 2^-20

m

10^-3 / 2^-10

c

10^-2

d

10^-1

h

10^2

k

10^3 / 2^10

K

10^3 / 2^10

M

10^6 / 2^20

G

10^9 / 2^30

T

10^12 / 2^40

P

10^15 / 2^40

E

10^18 / 2^50

Z

10^21 / 2^60

Y

10^24 / 2^70

8 OpenCL Options

When FFmpeg is configured with --enable-opencl, it is possible to set the options for the global OpenCL context.

The list of supported options follows:

build_options

Set build options used to compile the registered kernels.

See reference "OpenCL Specification Version: 1.2 chapter 5.6.4".

platform_idx

Select the index of the platform to run OpenCL code.

The specified index must be one of the indexes in the device list which can be obtained with ffmpeg -opencl_bench or av_opencl_get_device_list().

device_idx

Select the index of the device used to run OpenCL code.

The specified index must be one of the indexes in the device list which can be obtained with ffmpeg -opencl_bench or av_opencl_get_device_list().

9 Codec Options

libavcodec provides some generic global options, which can be set on all the encoders and decoders. In addition each codec may support so-called private options, which are specific for a given codec.

Sometimes, a global option may only affect a specific kind of codec, and may be nonsensical or ignored by another, so you need to be aware of the meaning of the specified options. Also some options are meant only for decoding or encoding.

Options may be set by specifying -option value in the FFmpeg tools, or by setting the value explicitly in the AVCodecContext options or using the libavutil/opt.h API for programmatic use.

The list of supported options follow:

b integer (encoding,audio,video)

Set bitrate in bits/s. Default value is 200K.

ab integer (encoding,audio)

Set audio bitrate (in bits/s). Default value is 128K.

bt integer (encoding,video)

Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far ratecontrol is willing to deviate from the target average bitrate value. This is not related to min/max bitrate. Lowering tolerance too much has an adverse effect on quality.

flags flags (decoding/encoding,audio,video,subtitles)

Set generic flags.

Possible values:

mv4

Use four motion vector by macroblock (mpeg4).

qpel

Use 1/4 pel motion compensation.

loop

Use loop filter.

qscale

Use fixed qscale.

gmc

Use gmc.

mv0

Always try a mb with mv=<0,0>.

input_preserved
pass1

Use internal 2pass ratecontrol in first pass mode.

pass2

Use internal 2pass ratecontrol in second pass mode.

gray

Only decode/encode grayscale.

emu_edge

Do not draw edges.

psnr

Set error[?] variables during encoding.

truncated
naq

Normalize adaptive quantization.

ildct

Use interlaced DCT.

low_delay

Force low delay.

global_header

Place global headers in extradata instead of every keyframe.

bitexact

Only write platform-, build- and time-independent data. (except (I)DCT). This ensures that file and data checksums are reproducible and match between platforms. Its primary use is for regression testing.

aic

Apply H263 advanced intra coding / mpeg4 ac prediction.

cbp

Deprecated, use mpegvideo private options instead.

qprd

Deprecated, use mpegvideo private options instead.

ilme

Apply interlaced motion estimation.

cgop

Use closed gop.

me_method integer (encoding,video)

Set motion estimation method.

Possible values:

zero

zero motion estimation (fastest)

full

full motion estimation (slowest)

epzs

EPZS motion estimation (default)

esa

esa motion estimation (alias for full)

tesa

tesa motion estimation

dia

dia motion estimation (alias for epzs)

log

log motion estimation

phods

phods motion estimation

x1

X1 motion estimation

hex

hex motion estimation

umh

umh motion estimation

iter

iter motion estimation

extradata_size integer

Set extradata size.

time_base rational number

Set codec time base.

It is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be 1 / frame_rate and timestamp increments should be identically 1.

g integer (encoding,video)

Set the group of picture size. Default value is 12.

ar integer (decoding/encoding,audio)

Set audio sampling rate (in Hz).

ac integer (decoding/encoding,audio)

Set number of audio channels.

cutoff integer (encoding,audio)

Set cutoff bandwidth.

frame_size integer (encoding,audio)

Set audio frame size.

Each submitted frame except the last must contain exactly frame_size samples per channel. May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not restricted. It is set by some decoders to indicate constant frame size.

frame_number integer

Set the frame number.

delay integer
qcomp float (encoding,video)

Set video quantizer scale compression (VBR). It is used as a constant in the ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0.

qblur float (encoding,video)

Set video quantizer scale blur (VBR).

qmin integer (encoding,video)

Set min video quantizer scale (VBR). Must be included between -1 and 69, default value is 2.

qmax integer (encoding,video)

Set max video quantizer scale (VBR). Must be included between -1 and 1024, default value is 31.

qdiff integer (encoding,video)

Set max difference between the quantizer scale (VBR).

bf integer (encoding,video)

Set max number of B frames between non-B-frames.

Must be an integer between -1 and 16. 0 means that B-frames are disabled. If a value of -1 is used, it will choose an automatic value depending on the encoder.

Default value is 0.

b_qfactor float (encoding,video)

Set qp factor between P and B frames.

rc_strategy integer (encoding,video)

Set ratecontrol method.

b_strategy integer (encoding,video)

Set strategy to choose between I/P/B-frames.

ps integer (encoding,video)

Set RTP payload size in bytes.

mv_bits integer
header_bits integer
i_tex_bits integer
p_tex_bits integer
i_count integer
p_count integer
skip_count integer
misc_bits integer
frame_bits integer
codec_tag integer
bug flags (decoding,video)

Workaround not auto detected encoder bugs.

Possible values:

autodetect
old_msmpeg4

some old lavc generated msmpeg4v3 files (no autodetection)

xvid_ilace

Xvid interlacing bug (autodetected if fourcc==XVIX)

ump4

(autodetected if fourcc==UMP4)

no_padding

padding bug (autodetected)

amv
ac_vlc

illegal vlc bug (autodetected per fourcc)

qpel_chroma
std_qpel

old standard qpel (autodetected per fourcc/version)

qpel_chroma2
direct_blocksize

direct-qpel-blocksize bug (autodetected per fourcc/version)

edge

edge padding bug (autodetected per fourcc/version)

hpel_chroma
dc_clip
ms

Workaround various bugs in microsoft broken decoders.

trunc

trancated frames

lelim integer (encoding,video)

Set single coefficient elimination threshold for luminance (negative values also consider DC coefficient).

celim integer (encoding,video)

Set single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)

strict integer (decoding/encoding,audio,video)

Specify how strictly to follow the standards.

Possible values:

very

strictly conform to a older more strict version of the spec or reference software

strict

strictly conform to all the things in the spec no matter what consequences

normal
unofficial

allow unofficial extensions

experimental

allow non standardized experimental things, experimental (unfinished/work in progress/not well tested) decoders and encoders. Note: experimental decoders can pose a security risk, do not use this for decoding untrusted input.

b_qoffset float (encoding,video)

Set QP offset between P and B frames.

err_detect flags (decoding,audio,video)

Set error detection flags.

Possible values:

crccheck

verify embedded CRCs

bitstream

detect bitstream specification deviations

buffer

detect improper bitstream length

explode

abort decoding on minor error detection

ignore_err

ignore decoding errors, and continue decoding. This is useful if you want to analyze the content of a video and thus want everything to be decoded no matter what. This option will not result in a video that is pleasing to watch in case of errors.

careful

consider things that violate the spec and have not been seen in the wild as errors

compliant

consider all spec non compliancies as errors

aggressive

consider things that a sane encoder should not do as an error

has_b_frames integer
block_align integer
mpeg_quant integer (encoding,video)

Use MPEG quantizers instead of H.263.

qsquish float (encoding,video)

How to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function).

rc_qmod_amp float (encoding,video)

Set experimental quantizer modulation.

rc_qmod_freq integer (encoding,video)

Set experimental quantizer modulation.

rc_override_count integer
rc_eq string (encoding,video)

Set rate control equation. When computing the expression, besides the standard functions defined in the section ’Expression Evaluation’, the following functions are available: bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.

maxrate integer (encoding,audio,video)

Set max bitrate tolerance (in bits/s). Requires bufsize to be set.

minrate integer (encoding,audio,video)

Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use elsewise.

bufsize integer (encoding,audio,video)

Set ratecontrol buffer size (in bits).

rc_buf_aggressivity float (encoding,video)

Currently useless.

i_qfactor float (encoding,video)

Set QP factor between P and I frames.

i_qoffset float (encoding,video)

Set QP offset between P and I frames.

rc_init_cplx float (encoding,video)

Set initial complexity for 1-pass encoding.

dct integer (encoding,video)

Set DCT algorithm.

Possible values:

auto

autoselect a good one (default)

fastint

fast integer

int

accurate integer

mmx
altivec
faan

floating point AAN DCT

lumi_mask float (encoding,video)

Compress bright areas stronger than medium ones.

tcplx_mask float (encoding,video)

Set temporal complexity masking.

scplx_mask float (encoding,video)

Set spatial complexity masking.

p_mask float (encoding,video)

Set inter masking.

dark_mask float (encoding,video)

Compress dark areas stronger than medium ones.

idct integer (decoding/encoding,video)

Select IDCT implementation.

Possible values:

auto
int
simple
simplemmx
simpleauto

Automatically pick a IDCT compatible with the simple one

arm
altivec
sh4
simplearm
simplearmv5te
simplearmv6
simpleneon
simplealpha
ipp
xvidmmx
faani

floating point AAN IDCT

slice_count integer
ec flags (decoding,video)

Set error concealment strategy.

Possible values:

guess_mvs

iterative motion vector (MV) search (slow)

deblock

use strong deblock filter for damaged MBs

favor_inter

favor predicting from the previous frame instead of the current

bits_per_coded_sample integer
pred integer (encoding,video)

Set prediction method.

Possible values:

left
plane
median
aspect rational number (encoding,video)

Set sample aspect ratio.

debug flags (decoding/encoding,audio,video,subtitles)

Print specific debug info.

Possible values:

pict

picture info

rc

rate control

bitstream
mb_type

macroblock (MB) type

qp

per-block quantization parameter (QP)

mv

motion vector

dct_coeff
skip
startcode
pts
er

error recognition

mmco

memory management control operations (H.264)

bugs
vis_qp

visualize quantization parameter (QP), lower QP are tinted greener

vis_mb_type

visualize block types

buffers

picture buffer allocations

thread_ops

threading operations

nomc

skip motion compensation

vismv integer (decoding,video)

Visualize motion vectors (MVs).

This option is deprecated, see the codecview filter instead.

Possible values:

pf

forward predicted MVs of P-frames

bf

forward predicted MVs of B-frames

bb

backward predicted MVs of B-frames

cmp integer (encoding,video)

Set full pel me compare function.

Possible values:

sad

sum of absolute differences, fast (default)

sse

sum of squared errors

satd

sum of absolute Hadamard transformed differences

dct

sum of absolute DCT transformed differences

psnr

sum of squared quantization errors (avoid, low quality)

bit

number of bits needed for the block

rd

rate distortion optimal, slow

zero

0

vsad

sum of absolute vertical differences

vsse

sum of squared vertical differences

nsse

noise preserving sum of squared differences

w53

5/3 wavelet, only used in snow

w97

9/7 wavelet, only used in snow

dctmax
chroma
subcmp integer (encoding,video)

Set sub pel me compare function.

Possible values:

sad

sum of absolute differences, fast (default)

sse

sum of squared errors

satd

sum of absolute Hadamard transformed differences

dct

sum of absolute DCT transformed differences

psnr

sum of squared quantization errors (avoid, low quality)

bit

number of bits needed for the block

rd

rate distortion optimal, slow

zero

0

vsad

sum of absolute vertical differences

vsse

sum of squared vertical differences

nsse

noise preserving sum of squared differences

w53

5/3 wavelet, only used in snow

w97

9/7 wavelet, only used in snow

dctmax
chroma
mbcmp integer (encoding,video)

Set macroblock compare function.

Possible values:

sad

sum of absolute differences, fast (default)

sse

sum of squared errors

satd

sum of absolute Hadamard transformed differences

dct

sum of absolute DCT transformed differences

psnr

sum of squared quantization errors (avoid, low quality)

bit

number of bits needed for the block

rd

rate distortion optimal, slow

zero

0

vsad

sum of absolute vertical differences

vsse

sum of squared vertical differences

nsse

noise preserving sum of squared differences

w53

5/3 wavelet, only used in snow

w97

9/7 wavelet, only used in snow

dctmax
chroma
ildctcmp integer (encoding,video)

Set interlaced dct compare function.

Possible values:

sad

sum of absolute differences, fast (default)

sse

sum of squared errors

satd

sum of absolute Hadamard transformed differences

dct

sum of absolute DCT transformed differences

psnr

sum of squared quantization errors (avoid, low quality)

bit

number of bits needed for the block

rd

rate distortion optimal, slow

zero

0

vsad

sum of absolute vertical differences

vsse

sum of squared vertical differences

nsse

noise preserving sum of squared differences

w53

5/3 wavelet, only used in snow

w97

9/7 wavelet, only used in snow

dctmax
chroma
dia_size integer (encoding,video)

Set diamond type & size for motion estimation.

last_pred integer (encoding,video)

Set amount of motion predictors from the previous frame.

preme integer (encoding,video)

Set pre motion estimation.

precmp integer (encoding,video)

Set pre motion estimation compare function.

Possible values:

sad

sum of absolute differences, fast (default)

sse

sum of squared errors

satd

sum of absolute Hadamard transformed differences

dct

sum of absolute DCT transformed differences

psnr

sum of squared quantization errors (avoid, low quality)

bit

number of bits needed for the block

rd

rate distortion optimal, slow

zero

0

vsad

sum of absolute vertical differences

vsse

sum of squared vertical differences

nsse

noise preserving sum of squared differences

w53

5/3 wavelet, only used in snow

w97

9/7 wavelet, only used in snow

dctmax
chroma
pre_dia_size integer (encoding,video)

Set diamond type & size for motion estimation pre-pass.

subq integer (encoding,video)

Set sub pel motion estimation quality.

dtg_active_format integer
me_range integer (encoding,video)

Set limit motion vectors range (1023 for DivX player).

ibias integer (encoding,video)

Set intra quant bias.

pbias integer (encoding,video)

Set inter quant bias.

color_table_id integer
global_quality integer (encoding,audio,video)
coder integer (encoding,video)

Possible values:

vlc

variable length coder / huffman coder

ac

arithmetic coder

raw

raw (no encoding)

rle

run-length coder

deflate

deflate-based coder

context integer (encoding,video)

Set context model.

slice_flags integer
xvmc_acceleration integer
mbd integer (encoding,video)

Set macroblock decision algorithm (high quality mode).

Possible values:

simple

use mbcmp (default)

bits

use fewest bits

rd

use best rate distortion

stream_codec_tag integer
sc_threshold integer (encoding,video)

Set scene change threshold.

lmin integer (encoding,video)

Set min lagrange factor (VBR).

lmax integer (encoding,video)

Set max lagrange factor (VBR).

nr integer (encoding,video)

Set noise reduction.

rc_init_occupancy integer (encoding,video)

Set number of bits which should be loaded into the rc buffer before decoding starts.

flags2 flags (decoding/encoding,audio,video)

Possible values:

fast

Allow non spec compliant speedup tricks.

sgop

Deprecated, use mpegvideo private options instead.

noout

Skip bitstream encoding.

ignorecrop

Ignore cropping information from sps.

local_header

Place global headers at every keyframe instead of in extradata.

chunks

Frame data might be split into multiple chunks.

showall

Show all frames before the first keyframe.

skiprd

Deprecated, use mpegvideo private options instead.

export_mvs

Export motion vectors into frame side-data (see AV_FRAME_DATA_MOTION_VECTORS) for codecs that support it. See also doc/examples/export_mvs.c.

error integer (encoding,video)
qns integer (encoding,video)

Deprecated, use mpegvideo private options instead.

threads integer (decoding/encoding,video)

Possible values:

auto

detect a good number of threads

me_threshold integer (encoding,video)

Set motion estimation threshold.

mb_threshold integer (encoding,video)

Set macroblock threshold.

dc integer (encoding,video)

Set intra_dc_precision.

nssew integer (encoding,video)

Set nsse weight.

skip_top integer (decoding,video)

Set number of macroblock rows at the top which are skipped.

skip_bottom integer (decoding,video)

Set number of macroblock rows at the bottom which are skipped.

profile integer (encoding,audio,video)

Possible values:

unknown
aac_main
aac_low
aac_ssr
aac_ltp
aac_he
aac_he_v2
aac_ld
aac_eld
mpeg2_aac_low
mpeg2_aac_he
mpeg4_sp
mpeg4_core
mpeg4_main
mpeg4_asp
dts
dts_es
dts_96_24
dts_hd_hra
dts_hd_ma
level integer (encoding,audio,video)

Possible values:

unknown
lowres integer (decoding,audio,video)

Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions.

skip_threshold integer (encoding,video)

Set frame skip threshold.

skip_factor integer (encoding,video)

Set frame skip factor.

skip_exp integer (encoding,video)

Set frame skip exponent. Negative values behave identical to the corresponding positive ones, except that the score is normalized. Positive values exist primarily for compatibility reasons and are not so useful.

skipcmp integer (encoding,video)

Set frame skip compare function.

Possible values:

sad

sum of absolute differences, fast (default)

sse

sum of squared errors

satd

sum of absolute Hadamard transformed differences

dct

sum of absolute DCT transformed differences

psnr

sum of squared quantization errors (avoid, low quality)

bit

number of bits needed for the block

rd

rate distortion optimal, slow

zero

0

vsad

sum of absolute vertical differences

vsse

sum of squared vertical differences

nsse

noise preserving sum of squared differences

w53

5/3 wavelet, only used in snow

w97

9/7 wavelet, only used in snow

dctmax
chroma
border_mask float (encoding,video)

Increase the quantizer for macroblocks close to borders.

mblmin integer (encoding,video)

Set min macroblock lagrange factor (VBR).

mblmax integer (encoding,video)

Set max macroblock lagrange factor (VBR).

mepc integer (encoding,video)

Set motion estimation bitrate penalty compensation (1.0 = 256).

skip_loop_filter integer (decoding,video)
skip_idct integer (decoding,video)
skip_frame integer (decoding,video)

Make decoder discard processing depending on the frame type selected by the option value.

skip_loop_filter skips frame loop filtering, skip_idct skips frame IDCT/dequantization, skip_frame skips decoding.

Possible values:

none

Discard no frame.

default

Discard useless frames like 0-sized frames.

noref

Discard all non-reference frames.

bidir

Discard all bidirectional frames.

nokey

Discard all frames excepts keyframes.

all

Discard all frames.

Default value is ‘default’.

bidir_refine integer (encoding,video)

Refine the two motion vectors used in bidirectional macroblocks.

brd_scale integer (encoding,video)

Downscale frames for dynamic B-frame decision.

keyint_min integer (encoding,video)

Set minimum interval between IDR-frames.

refs integer (encoding,video)

Set reference frames to consider for motion compensation.

chromaoffset integer (encoding,video)

Set chroma qp offset from luma.

trellis integer (encoding,audio,video)

Set rate-distortion optimal quantization.

sc_factor integer (encoding,video)

Set value multiplied by qscale for each frame and added to scene_change_score.

mv0_threshold integer (encoding,video)
b_sensitivity integer (encoding,video)

Adjust sensitivity of b_frame_strategy 1.

compression_level integer (encoding,audio,video)
min_prediction_order integer (encoding,audio)
max_prediction_order integer (encoding,audio)
timecode_frame_start integer (encoding,video)

Set GOP timecode frame start number, in non drop frame format.

request_channels integer (decoding,audio)

Set desired number of audio channels.

bits_per_raw_sample integer
channel_layout integer (decoding/encoding,audio)

Possible values:

request_channel_layout integer (decoding,audio)

Possible values:

rc_max_vbv_use float (encoding,video)
rc_min_vbv_use float (encoding,video)
ticks_per_frame integer (decoding/encoding,audio,video)
color_primaries integer (decoding/encoding,video)
color_trc integer (decoding/encoding,video)
colorspace integer (decoding/encoding,video)
color_range integer (decoding/encoding,video)
chroma_sample_location integer (decoding/encoding,video)
log_level_offset integer

Set the log level offset.

slices integer (encoding,video)

Number of slices, used in parallelized encoding.

thread_type flags (decoding/encoding,video)

Select which multithreading methods to use.

Use of ‘frame’ will increase decoding delay by one frame per thread, so clients which cannot provide future frames should not use it.

Possible values:

slice

Decode more than one part of a single frame at once.

Multithreading using slices works only when the video was encoded with slices.

frame

Decode more than one frame at once.

Default value is ‘slice+frame’.

audio_service_type integer (encoding,audio)

Set audio service type.

Possible values:

ma

Main Audio Service

ef

Effects

vi

Visually Impaired

hi

Hearing Impaired

di

Dialogue

co

Commentary

em

Emergency

vo

Voice Over

ka

Karaoke

request_sample_fmt sample_fmt (decoding,audio)

Set sample format audio decoders should prefer. Default value is none.

pkt_timebase rational number
sub_charenc encoding (decoding,subtitles)

Set the input subtitles character encoding.

field_order field_order (video)

Set/override the field order of the video. Possible values:

progressive

Progressive video

tt

Interlaced video, top field coded and displayed first

bb

Interlaced video, bottom field coded and displayed first

tb

Interlaced video, top coded first, bottom displayed first

bt

Interlaced video, bottom coded first, top displayed first

skip_alpha integer (decoding,video)

Set to 1 to disable processing alpha (transparency). This works like the ‘gray’ flag in the flags option which skips chroma information instead of alpha. Default is 0.

codec_whitelist list (input)

"," separated List of allowed decoders. By default all are allowed.

dump_separator string (input)

Separator used to separate the fields printed on the command line about the Stream parameters. For example to separate the fields with newlines and indention:

ffprobe -dump_separator "
                          "  -i ~/videos/matrixbench_mpeg2.mpg

10 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.

11 Video Decoders

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

11.1 rawvideo

Raw video decoder.

This decoder decodes rawvideo streams.

11.1.1 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

12 Audio Decoders

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

12.1 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).

12.1.1 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. 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.

12.2 flac

FLAC audio decoder.

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

12.2.1 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 allows to decode such streams correctly by using lavc’s old buggy lpc logic for decoding.

12.3 ffwavesynth

Internal wave synthetizer.

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.

12.4 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.

12.5 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.

12.6 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.

12.6.1 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).

12.7 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.

12.8 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.

12.9 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.

13 Subtitles Decoders

13.1 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.

13.1.1 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 comas, 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.

13.2 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.

13.2.1 Options

txt_page

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

txt_chop_top

Discards the top teletext line. Default value is 1.

txt_format

Specifies the format of the decoded subtitles. The teletext decoder is capable of decoding the teletext pages to bitmaps or to simple text, you should use "bitmap" for teletext pages, because certain graphics and colors cannot be expressed in simple text. You might use "text" for teletext based subtitles if your application can handle simple text based subtitles. Default value is bitmap.

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 charactes. Default value is 1.

txt_duration

Sets the display duration of the decoded teletext pages or subtitles in miliseconds. Default value is 30000 which is 30 seconds.

txt_transparent

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

14 Bitstream Filters

When you configure your FFmpeg build, all the supported bitstream filters are enabled by default. You can list all available ones using the configure option --list-bsfs.

You can disable all the bitstream filters using the configure option --disable-bsfs, and selectively enable any bitstream filter using the option --enable-bsf=BSF, or you can disable a particular bitstream filter using the option --disable-bsf=BSF.

The option -bsfs of the ff* tools will display the list of all the supported bitstream filters included in your build.

The ff* tools have a -bsf option applied per stream, taking a comma-separated list of filters, whose parameters follow the filter name after a ’=’.

ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1/opt2=str2][,filter2] OUTPUT

Below is a description of the currently available bitstream filters, with their parameters, if any.

14.1 aac_adtstoasc

Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration bitstream filter.

This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 ADTS header and removes the ADTS header.

This is required for example when copying an AAC stream from a raw ADTS AAC container to a FLV or a MOV/MP4 file.

14.2 chomp

Remove zero padding at the end of a packet.

14.3 dump_extra

Add extradata to the beginning of the filtered packets.

The additional argument specifies which packets should be filtered. It accepts the values:

a

add extradata to all key packets, but only if local_header is set in the flags2 codec context field

k

add extradata to all key packets

e

add extradata to all packets

If not specified it is assumed ‘k’.

For example the following ffmpeg command forces a global header (thus disabling individual packet headers) in the H.264 packets generated by the libx264 encoder, but corrects them by adding the header stored in extradata to the key packets:

ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts

14.4 h264_mp4toannexb

Convert an H.264 bitstream from length prefixed mode to start code prefixed mode (as defined in the Annex B of the ITU-T H.264 specification).

This is required by some streaming formats, typically the MPEG-2 transport stream format ("mpegts").

For example to remux an MP4 file containing an H.264 stream to mpegts format with ffmpeg, you can use the command:

ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts

14.5 imxdump

Modifies the bitstream to fit in MOV and to be usable by the Final Cut Pro decoder. This filter only applies to the mpeg2video codec, and is likely not needed for Final Cut Pro 7 and newer with the appropriate -tag:v.

For example, to remux 30 MB/sec NTSC IMX to MOV:

ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov

14.6 mjpeg2jpeg

Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.

MJPEG is a video codec wherein each video frame is essentially a JPEG image. The individual frames can be extracted without loss, e.g. by

ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg

Unfortunately, these chunks are incomplete JPEG images, because they lack the DHT segment required for decoding. Quoting from http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml:

Avery Lee, writing in the rec.video.desktop newsgroup in 2001, commented that "MJPEG, or at least the MJPEG in AVIs having the MJPG fourcc, is restricted JPEG with a fixed – and *omitted* – Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2, and it must use basic Huffman encoding, not arithmetic or progressive. . . . You can indeed extract the MJPEG frames and decode them with a regular JPEG decoder, but you have to prepend the DHT segment to them, or else the decoder won’t have any idea how to decompress the data. The exact table necessary is given in the OpenDML spec."

This bitstream filter patches the header of frames extracted from an MJPEG stream (carrying the AVI1 header ID and lacking a DHT segment) to produce fully qualified JPEG images.

ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
exiftran -i -9 frame*.jpg
ffmpeg -i frame_%d.jpg -c:v copy rotated.avi

14.7 mjpega_dump_header

14.8 movsub

14.9 mp3_header_decompress

14.10 mpeg4_unpack_bframes

Unpack DivX-style packed B-frames.

DivX-style packed B-frames are not valid MPEG-4 and were only a workaround for the broken Video for Windows subsystem. They use more space, can cause minor AV sync issues, require more CPU power to decode (unless the player has some decoded picture queue to compensate the 2,0,2,0 frame per packet style) and cause trouble if copied into a standard container like mp4 or mpeg-ps/ts, because MPEG-4 decoders may not be able to decode them, since they are not valid MPEG-4.

For example to fix an AVI file containing an MPEG-4 stream with DivX-style packed B-frames using ffmpeg, you can use the command:

ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi

14.11 noise

Damages the contents of packets without damaging the container. Can be used for fuzzing or testing error resilience/concealment.

Parameters: A numeral string, whose value is related to how often output bytes will be modified. Therefore, values below or equal to 0 are forbidden, and the lower the more frequent bytes will be modified, with 1 meaning every byte is modified.

ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv

applies the modification to every byte.

14.12 remove_extra

15 Format Options

The libavformat library provides some generic global options, which can be set on all the muxers and demuxers. In addition each muxer or demuxer may support so-called private options, which are specific for that component.

Options may be set by specifying -option value in the FFmpeg tools, or by setting the value explicitly in the AVFormatContext options or using the libavutil/opt.h API for programmatic use.

The list of supported options follows:

avioflags flags (input/output)

Possible values:

direct

Reduce buffering.

probesize integer (input)

Set probing size in bytes, i.e. the size of the data to analyze to get stream information. A higher value will enable detecting more information in case it is dispersed into the stream, but will increase latency. Must be an integer not lesser than 32. It is 5000000 by default.

packetsize integer (output)

Set packet size.

fflags flags (input/output)

Set format flags.

Possible values:

ignidx

Ignore index.

fastseek

Enable fast, but inaccurate seeks for some formats.

genpts

Generate PTS.

nofillin

Do not fill in missing values that can be exactly calculated.

noparse

Disable AVParsers, this needs +nofillin too.

igndts

Ignore DTS.

discardcorrupt

Discard corrupted frames.

sortdts

Try to interleave output packets by DTS.

keepside

Do not merge side data.

latm

Enable RTP MP4A-LATM payload.

nobuffer

Reduce the latency introduced by optional buffering

bitexact

Only write platform-, build- and time-independent data. This ensures that file and data checksums are reproducible and match between platforms. Its primary use is for regression testing.

seek2any integer (input)

Allow seeking to non-keyframes on demuxer level when supported if set to 1. Default is 0.

analyzeduration integer (input)

Specify how many microseconds are analyzed to probe the input. A higher value will enable detecting more accurate information, but will increase latency. It defaults to 5,000,000 microseconds = 5 seconds.

cryptokey hexadecimal string (input)

Set decryption key.

indexmem integer (input)

Set max memory used for timestamp index (per stream).

rtbufsize integer (input)

Set max memory used for buffering real-time frames.

fdebug flags (input/output)

Print specific debug info.

Possible values:

ts
max_delay integer (input/output)

Set maximum muxing or demuxing delay in microseconds.

fpsprobesize integer (input)

Set number of frames used to probe fps.

audio_preload integer (output)

Set microseconds by which audio packets should be interleaved earlier.

chunk_duration integer (output)

Set microseconds for each chunk.

chunk_size integer (output)

Set size in bytes for each chunk.

err_detect, f_err_detect flags (input)

Set error detection flags. f_err_detect is deprecated and should be used only via the ffmpeg tool.

Possible values:

crccheck

Verify embedded CRCs.

bitstream

Detect bitstream specification deviations.

buffer

Detect improper bitstream length.

explode

Abort decoding on minor error detection.

careful

Consider things that violate the spec and have not been seen in the wild as errors.

compliant

Consider all spec non compliancies as errors.

aggressive

Consider things that a sane encoder should not do as an error.

max_interleave_delta integer (output)

Set maximum buffering duration for interleaving. The duration is expressed in microseconds, and defaults to 1000000 (1 second).

To ensure all the streams are interleaved correctly, libavformat will wait until it has at least one packet for each stream before actually writing any packets to the output file. When some streams are "sparse" (i.e. there are large gaps between successive packets), this can result in excessive buffering.

This field specifies the maximum difference between the timestamps of the first and the last packet in the muxing queue, above which libavformat will output a packet regardless of whether it has queued a packet for all the streams.

If set to 0, libavformat will continue buffering packets until it has a packet for each stream, regardless of the maximum timestamp difference between the buffered packets.

use_wallclock_as_timestamps integer (input)

Use wallclock as timestamps.

avoid_negative_ts integer (output)

Possible values:

make_non_negative

Shift timestamps to make them non-negative. Also note that this affects only leading negative timestamps, and not non-monotonic negative timestamps.

make_zero

Shift timestamps so that the first timestamp is 0.

auto (default)

Enables shifting when required by the target format.

disabled

Disables shifting of timestamp.

When shifting is enabled, all output timestamps are shifted by the same amount. Audio, video, and subtitles desynching and relative timestamp differences are preserved compared to how they would have been without shifting.

skip_initial_bytes integer (input)

Set number of bytes to skip before reading header and frames if set to 1. Default is 0.

correct_ts_overflow integer (input)

Correct single timestamp overflows if set to 1. Default is 1.

flush_packets integer (output)

Flush the underlying I/O stream after each packet. Default 1 enables it, and has the effect of reducing the latency; 0 disables it and may slightly increase performance in some cases.

output_ts_offset offset (output)

Set the output time offset.

offset must be a time duration specification, see (ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual.

The offset is added by the muxer to the output timestamps.

Specifying a positive offset means that the corresponding streams are delayed bt the time duration specified in offset. Default value is 0 (meaning that no offset is applied).

format_whitelist list (input)

"," separated List of allowed demuxers. By default all are allowed.

dump_separator string (input)

Separator used to separate the fields printed on the command line about the Stream parameters. For example to separate the fields with newlines and indention:

ffprobe -dump_separator "
                          "  -i ~/videos/matrixbench_mpeg2.mpg

15.1 Format stream specifiers

Format stream specifiers allow selection of one or more streams that match specific properties.

Possible forms of stream specifiers are:

stream_index

Matches the stream with this index.

stream_type[:stream_index]

stream_type is one of following: ’v’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. If stream_index is given, then it matches the stream number stream_index of this type. Otherwise, it matches all streams of this type.

p:program_id[:stream_index]

If stream_index is given, then it matches the stream with number stream_index in the program with the id program_id. Otherwise, it matches all streams in the program.

#stream_id

Matches the stream by a format-specific ID.

The exact semantics of stream specifiers is defined by the avformat_match_stream_specifier() function declared in the libavformat/avformat.h header.

16 Demuxers

Demuxers are configured elements in FFmpeg that can read the multimedia streams from a particular type of file.

When you configure your FFmpeg build, all the supported demuxers are enabled by default. You can list all available ones using the configure option --list-demuxers.

You can disable all the demuxers using the configure option --disable-demuxers, and selectively enable a single demuxer with the option --enable-demuxer=DEMUXER, or disable it with the option --disable-demuxer=DEMUXER.

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

The description of some of the currently available demuxers follows.

16.1 applehttp

Apple HTTP Live Streaming demuxer.

This demuxer presents all AVStreams from all variant streams. The id field is set to the bitrate variant index number. By setting the discard flags on AVStreams (by pressing ’a’ or ’v’ in ffplay), the caller can decide which variant streams to actually receive. The total bitrate of the variant that the stream belongs to is available in a metadata key named "variant_bitrate".

16.2 apng

Animated Portable Network Graphics demuxer.

This demuxer is used to demux APNG files. All headers, but the PNG signature, up to (but not including) the first fcTL chunk are transmitted as extradata. Frames are then split as being all the chunks between two fcTL ones, or between the last fcTL and IEND chunks.

-ignore_loop bool

Ignore the loop variable in the file if set.

-max_fps int

Maximum framerate in frames per second (0 for no limit).

-default_fps int

Default framerate in frames per second when none is specified in the file (0 meaning as fast as possible).

16.3 asf

Advanced Systems Format demuxer.

This demuxer is used to demux ASF files and MMS network streams.

-no_resync_search bool

Do not try to resynchronize by looking for a certain optional start code.

16.4 concat

Virtual concatenation script demuxer.

This demuxer reads a list of files and other directives from a text file and demuxes them one after the other, as if all their packet had been muxed together.

The timestamps in the files are adjusted so that the first file starts at 0 and each next file starts where the previous one finishes. Note that it is done globally and may cause gaps if all streams do not have exactly the same length.

All files must have the same streams (same codecs, same time base, etc.).

The duration of each file is used to adjust the timestamps of the next file: if the duration is incorrect (because it was computed using the bit-rate or because the file is truncated, for example), it can cause artifacts. The duration directive can be used to override the duration stored in each file.

16.4.1 Syntax

The script is a text file in extended-ASCII, with one directive per line. Empty lines, leading spaces and lines starting with ’#’ are ignored. The following directive is recognized:

file path

Path to a file to read; special characters and spaces must be escaped with backslash or single quotes.

All subsequent file-related directives apply to that file.

ffconcat version 1.0

Identify the script type and version. It also sets the safe option to 1 if it was to its default -1.

To make FFmpeg recognize the format automatically, this directive must appears exactly as is (no extra space or byte-order-mark) on the very first line of the script.

duration dur

Duration of the file. This information can be specified from the file; specifying it here may be more efficient or help if the information from the file is not available or accurate.

If the duration is set for all files, then it is possible to seek in the whole concatenated video.

stream

Introduce a stream in the virtual file. All subsequent stream-related directives apply to the last introduced stream. Some streams properties must be set in order to allow identifying the matching streams in the subfiles. If no streams are defined in the script, the streams from the first file are copied.

exact_stream_id id

Set the id of the stream. If this directive is given, the string with the corresponding id in the subfiles will be used. This is especially useful for MPEG-PS (VOB) files, where the order of the streams is not reliable.

16.4.2 Options

This demuxer accepts the following option:

safe

If set to 1, reject unsafe file paths. A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a component.

If set to 0, any file name is accepted.

The default is -1, it is equivalent to 1 if the format was automatically probed and 0 otherwise.

auto_convert

If set to 1, try to perform automatic conversions on packet data to make the streams concatenable. The default is 1.

Currently, the only conversion is adding the h264_mp4toannexb bitstream filter to H.264 streams in MP4 format. This is necessary in particular if there are resolution changes.

16.5 flv

Adobe Flash Video Format demuxer.

This demuxer is used to demux FLV files and RTMP network streams.

-flv_metadata bool

Allocate the streams according to the onMetaData array content.

16.6 libgme

The Game Music Emu library is a collection of video game music file emulators.

See http://code.google.com/p/game-music-emu/ for more information.

Some files have multiple tracks. The demuxer will pick the first track by default. The track_index option can be used to select a different track. Track indexes start at 0. The demuxer exports the number of tracks as tracks meta data entry.

For very large files, the max_size option may have to be adjusted.

16.7 libquvi

Play media from Internet services using the quvi project.

The demuxer accepts a format option to request a specific quality. It is by default set to best.

See http://quvi.sourceforge.net/ for more information.

FFmpeg needs to be built with --enable-libquvi for this demuxer to be enabled.

16.8 gif

Animated GIF demuxer.

It accepts the following options:

min_delay

Set the minimum valid delay between frames in hundredths of seconds. Range is 0 to 6000. Default value is 2.

max_gif_delay

Set the maximum valid delay between frames in hundredth of seconds. Range is 0 to 65535. Default value is 65535 (nearly eleven minutes), the maximum value allowed by the specification.

default_delay

Set the default delay between frames in hundredths of seconds. Range is 0 to 6000. Default value is 10.

ignore_loop

GIF files can contain information to loop a certain number of times (or infinitely). If ignore_loop is set to 1, then the loop setting from the input will be ignored and looping will not occur. If set to 0, then looping will occur and will cycle the number of times according to the GIF. Default value is 1.

For example, with the overlay filter, place an infinitely looping GIF over another video:

ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv

Note that in the above example the shortest option for overlay filter is used to end the output video at the length of the shortest input file, which in this case is input.mp4 as the GIF in this example loops infinitely.

16.9 image2

Image file demuxer.

This demuxer reads from a list of image files specified by a pattern. The syntax and meaning of the pattern is specified by the option pattern_type.

The pattern may contain a suffix which is used to automatically determine the format of the images contained in the files.

The size, the pixel format, and the format of each image must be the same for all the files in the sequence.

This demuxer accepts the following options:

framerate

Set the frame rate for the video stream. It defaults to 25.

loop

If set to 1, loop over the input. Default value is 0.

pattern_type

Select the pattern type used to interpret the provided filename.

pattern_type accepts one of the following values.

none

Disable pattern matching, therefore the video will only contain the specified image. You should use this option if you do not want to create sequences from multiple images and your filenames may contain special pattern characters.

sequence

Select a sequence pattern type, used to specify a sequence of files indexed by sequential numbers.

A sequence pattern may contain the string "%d" or "%0Nd", which specifies the position of the characters representing a sequential number in each filename matched by the pattern. If the form "%d0Nd" is used, the string representing the number in each filename is 0-padded and N is the total number of 0-padded digits representing the number. The literal character ’%’ can be specified in the pattern with the string "%%".

If the sequence pattern contains "%d" or "%0Nd", the first filename of the file list specified by the pattern must contain a number inclusively contained between start_number and start_number+start_number_range-1, and all the following numbers must be sequential.

For example the pattern "img-%03d.bmp" will match a sequence of filenames of the form img-001.bmp, img-002.bmp, ..., img-010.bmp, etc.; the pattern "i%%m%%g-%d.jpg" will match a sequence of filenames of the form i%m%g-1.jpg, i%m%g-2.jpg, ..., i%m%g-10.jpg, etc.

Note that the pattern must not necessarily contain "%d" or "%0Nd", for example to convert a single image file img.jpeg you can employ the command:

ffmpeg -i img.jpeg img.png
glob

Select a glob wildcard pattern type.

The pattern is interpreted like a glob() pattern. This is only selectable if libavformat was compiled with globbing support.

glob_sequence (deprecated, will be removed)

Select a mixed glob wildcard/sequence pattern.

If your version of libavformat was compiled with globbing support, and the provided pattern contains at least one glob meta character among %*?[]{} that is preceded by an unescaped "%", the pattern is interpreted like a glob() pattern, otherwise it is interpreted like a sequence pattern.

All glob special characters %*?[]{} must be prefixed with "%". To escape a literal "%" you shall use "%%".

For example the pattern foo-%*.jpeg will match all the filenames prefixed by "foo-" and terminating with ".jpeg", and foo-%?%?%?.jpeg will match all the filenames prefixed with "foo-", followed by a sequence of three characters, and terminating with ".jpeg".

This pattern type is deprecated in favor of glob and sequence.

Default value is glob_sequence.

pixel_format

Set the pixel format of the images to read. If not specified the pixel format is guessed from the first image file in the sequence.

start_number

Set the index of the file matched by the image file pattern to start to read from. Default value is 0.

start_number_range

Set the index interval range to check when looking for the first image file in the sequence, starting from start_number. Default value is 5.

ts_from_file

If set to 1, will set frame timestamp to modification time of image file. Note that monotonity of timestamps is not provided: images go in the same order as without this option. Default value is 0. If set to 2, will set frame timestamp to the modification time of the image file in nanosecond precision.

video_size

Set the video size of the images to read. If not specified the video size is guessed from the first image file in the sequence.

16.9.1 Examples

16.10 mpegts

MPEG-2 transport stream demuxer.

fix_teletext_pts

Overrides teletext packet PTS and DTS values with the timestamps calculated from the PCR of the first program which the teletext stream is part of and is not discarded. Default value is 1, set this option to 0 if you want your teletext packet PTS and DTS values untouched.

16.11 rawvideo

Raw video demuxer.

This demuxer allows one to read raw video data. Since there is no header specifying the assumed video parameters, the user must specify them in order to be able to decode the data correctly.

This demuxer accepts the following options:

framerate

Set input video frame rate. Default value is 25.

pixel_format

Set the input video pixel format. Default value is yuv420p.

video_size

Set the input video size. This value must be specified explicitly.

For example to read a rawvideo file input.raw with ffplay, assuming a pixel format of rgb24, a video size of 320x240, and a frame rate of 10 images per second, use the command:

ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw

16.12 sbg

SBaGen script demuxer.

This demuxer reads the script language used by SBaGen http://uazu.net/sbagen/ to generate binaural beats sessions. A SBG script looks like that:

-SE
a: 300-2.5/3 440+4.5/0
b: 300-2.5/0 440+4.5/3
off: -
NOW      == a
+0:07:00 == b
+0:14:00 == a
+0:21:00 == b
+0:30:00    off

A SBG script can mix absolute and relative timestamps. If the script uses either only absolute timestamps (including the script start time) or only relative ones, then its layout is fixed, and the conversion is straightforward. On the other hand, if the script mixes both kind of timestamps, then the NOW reference for relative timestamps will be taken from the current time of day at the time the script is read, and the script layout will be frozen according to that reference. That means that if the script is directly played, the actual times will match the absolute timestamps up to the sound controller’s clock accuracy, but if the user somehow pauses the playback or seeks, all times will be shifted accordingly.

16.13 tedcaptions

JSON captions used for TED Talks.

TED does not provide links to the captions, but they can be guessed from the page. The file tools/bookmarklets.html from the FFmpeg source tree contains a bookmarklet to expose them.

This demuxer accepts the following option:

start_time

Set the start time of the TED talk, in milliseconds. The default is 15000 (15s). It is used to sync the captions with the downloadable videos, because they include a 15s intro.

Example: convert the captions to a format most players understand:

ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt

17 Metadata

FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer.

The file format is as follows:

  1. A file consists of a header and a number of metadata tags divided into sections, each on its own line.
  2. The header is a ‘;FFMETADATA’ string, followed by a version number (now 1).
  3. Metadata tags are of the form ‘key=value
  4. Immediately after header follows global metadata
  5. After global metadata there may be sections with per-stream/per-chapter metadata.
  6. A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in brackets (‘[’, ‘]’) and ends with next section or end of file.
  7. At the beginning of a chapter section there may be an optional timebase to be used for start/end values. It must be in form ‘TIMEBASE=num/den’, where num and den are integers. If the timebase is missing then start/end times are assumed to be in milliseconds.

    Next a chapter section must contain chapter start and end times in form ‘START=num’, ‘END=num’, where num is a positive integer.

  8. Empty lines and lines starting with ‘;’ or ‘#’ are ignored.
  9. Metadata keys or values containing special characters (‘=’, ‘;’, ‘#’, ‘\’ and a newline) must be escaped with a backslash ‘\’.
  10. Note that whitespace in metadata (e.g. ‘foo = bar’) is considered to be a part of the tag (in the example above key is ‘foo ’, value is ‘ bar’).

A ffmetadata file might look like this:

;FFMETADATA1
title=bike\\shed
;this is a comment
artist=FFmpeg troll team

[CHAPTER]
TIMEBASE=1/1000
START=0
#chapter ends at 0:01:00
END=60000
title=chapter \#1
[STREAM]
title=multi\
line

By using the ffmetadata muxer and demuxer it is possible to extract metadata from an input file to an ffmetadata file, and then transcode the file into an output file with the edited ffmetadata file.

Extracting an ffmetadata file with ffmpeg goes as follows:

ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE

Reinserting edited metadata information from the FFMETADATAFILE file can be done as:

ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT

18 Protocols

Protocols are configured elements in FFmpeg that enable access to resources that require specific protocols.

When you configure your FFmpeg build, all the supported protocols are enabled by default. You can list all available ones using the configure option "–list-protocols".

You can disable all the protocols using the configure option "–disable-protocols", and selectively enable a protocol using the option "–enable-protocol=PROTOCOL", or you can disable a particular protocol using the option "–disable-protocol=PROTOCOL".

The option "-protocols" of the ff* tools will display the list of supported protocols.

A description of the currently available protocols follows.

18.1 bluray

Read BluRay playlist.

The accepted options are:

angle

BluRay angle

chapter

Start chapter (1...N)

playlist

Playlist to read (BDMV/PLAYLIST/?????.mpls)

Examples:

Read longest playlist from BluRay mounted to /mnt/bluray:

bluray:/mnt/bluray

Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:

-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray

18.2 cache

Caching wrapper for input stream.

Cache the input stream to temporary file. It brings seeking capability to live streams.

cache:URL

18.3 concat

Physical concatenation protocol.

Read and seek from many resources in sequence as if they were a unique resource.

A URL accepted by this protocol has the syntax:

concat:URL1|URL2|...|URLN

where URL1, URL2, ..., URLN are the urls of the resource to be concatenated, each one possibly specifying a distinct protocol.

For example to read a sequence of files split1.mpeg, split2.mpeg, split3.mpeg with ffplay use the command:

ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg

Note that you may need to escape the character "|" which is special for many shells.

18.4 crypto

AES-encrypted stream reading protocol.

The accepted options are:

key

Set the AES decryption key binary block from given hexadecimal representation.

iv

Set the AES decryption initialization vector binary block from given hexadecimal representation.

Accepted URL formats:

crypto:URL
crypto+URL

18.5 data

Data in-line in the URI. See http://en.wikipedia.org/wiki/Data_URI_scheme.

For example, to convert a GIF file given inline with ffmpeg:

ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png

18.6 file

File access protocol.

Read from or write to a file.

A file URL can have the form:

file:filename

where filename is the path of the file to read.

An URL that does not have a protocol prefix will be assumed to be a file URL. Depending on the build, an URL that looks like a Windows path with the drive letter at the beginning will also be assumed to be a file URL (usually not the case in builds for unix-like systems).

For example to read from a file input.mpeg with ffmpeg use the command:

ffmpeg -i file:input.mpeg output.mpeg

This protocol accepts the following options:

truncate

Truncate existing files on write, if set to 1. A value of 0 prevents truncating. Default value is 1.

blocksize

Set I/O operation maximum block size, in bytes. Default value is INT_MAX, which results in not limiting the requested block size. Setting this value reasonably low improves user termination request reaction time, which is valuable for files on slow medium.

18.7 ftp

FTP (File Transfer Protocol).

Read from or write to remote resources using FTP protocol.

Following syntax is required.

ftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg

This protocol accepts the following options.

timeout

Set timeout in microseconds of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

ftp-anonymous-password

Password used when login as anonymous user. Typically an e-mail address should be used.

ftp-write-seekable

Control seekability of connection during encoding. If set to 1 the resource is supposed to be seekable, if set to 0 it is assumed not to be seekable. Default value is 0.

NOTE: Protocol can be used as output, but it is recommended to not do it, unless special care is taken (tests, customized server configuration etc.). Different FTP servers behave in different way during seek operation. ff* tools may produce incomplete content due to server limitations.

18.8 gopher

Gopher protocol.

18.9 hls

Read Apple HTTP Live Streaming compliant segmented stream as a uniform one. The M3U8 playlists describing the segments can be remote HTTP resources or local files, accessed using the standard file protocol. The nested protocol is declared by specifying "+proto" after the hls URI scheme name, where proto is either "file" or "http".

hls+http://host/path/to/remote/resource.m3u8
hls+file://path/to/local/resource.m3u8

Using this protocol is discouraged - the hls demuxer should work just as well (if not, please report the issues) and is more complete. To use the hls demuxer instead, simply use the direct URLs to the m3u8 files.

18.10 http

HTTP (Hyper Text Transfer Protocol).

This protocol accepts the following options:

seekable

Control seekability of connection. If set to 1 the resource is supposed to be seekable, if set to 0 it is assumed not to be seekable, if set to -1 it will try to autodetect if it is seekable. Default value is -1.

chunked_post

If set to 1 use chunked Transfer-Encoding for posts, default is 1.

content_type

Set a specific content type for the POST messages.

headers

Set custom HTTP headers, can override built in default headers. The value must be a string encoding the headers.

multiple_requests

Use persistent connections if set to 1, default is 0.

post_data

Set custom HTTP post data.

user-agent
user_agent

Override the User-Agent header. If not specified the protocol will use a string describing the libavformat build. ("Lavf/<version>")

timeout

Set timeout in microseconds of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

mime_type

Export the MIME type.

icy

If set to 1 request ICY (SHOUTcast) metadata from the server. If the server supports this, the metadata has to be retrieved by the application by reading the icy_metadata_headers and icy_metadata_packet options. The default is 1.

icy_metadata_headers

If the server supports ICY metadata, this contains the ICY-specific HTTP reply headers, separated by newline characters.

icy_metadata_packet

If the server supports ICY metadata, and icy was set to 1, this contains the last non-empty metadata packet sent by the server. It should be polled in regular intervals by applications interested in mid-stream metadata updates.

cookies

Set the cookies to be sent in future requests. The format of each cookie is the same as the value of a Set-Cookie HTTP response field. Multiple cookies can be delimited by a newline character.

offset

Set initial byte offset.

end_offset

Try to limit the request to bytes preceding this offset.

method

When used as a client option it sets the HTTP method for the request.

When used as a server option it sets the HTTP method that is going to be expected from the client(s). If the expected and the received HTTP method do not match the client will be given a Bad Request response. When unset the HTTP method is not checked for now. This will be replaced by autodetection in the future.

listen

If set to 1 enables experimental HTTP server. This can be used to send data when used as an output option, or read data from a client with HTTP POST when used as an input option.

# Server side (sending):
ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://server:port

# Client side (receiving):
ffmpeg -i http://server:port -c copy somefile.ogg

# Client can also be done with wget:
wget http://server:port -O somefile.ogg

# Server side (receiving):
ffmpeg -listen 1 -i http://server:port -c copy somefile.ogg

# Client side (sending):
ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://server:port

# Client can also be done with wget:
wget --post-file=somefile.ogg http://server:port

18.10.1 HTTP Cookies

Some HTTP requests will be denied unless cookie values are passed in with the request. The cookies option allows these cookies to be specified. At the very least, each cookie must specify a value along with a path and domain. HTTP requests that match both the domain and path will automatically include the cookie value in the HTTP Cookie header field. Multiple cookies can be delimited by a newline.

The required syntax to play a stream specifying a cookie is:

ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8

18.11 Icecast

Icecast protocol (stream to Icecast servers)

This protocol accepts the following options:

ice_genre

Set the stream genre.

ice_name

Set the stream name.

ice_description

Set the stream description.

ice_url

Set the stream website URL.

ice_public

Set if the stream should be public. The default is 0 (not public).

user_agent

Override the User-Agent header. If not specified a string of the form "Lavf/<version>" will be used.

password

Set the Icecast mountpoint password.

content_type

Set the stream content type. This must be set if it is different from audio/mpeg.

legacy_icecast

This enables support for Icecast versions < 2.4.0, that do not support the HTTP PUT method but the SOURCE method.

icecast://[username[:password]@]server:port/mountpoint

18.12 mmst

MMS (Microsoft Media Server) protocol over TCP.

18.13 mmsh

MMS (Microsoft Media Server) protocol over HTTP.

The required syntax is:

mmsh://server[:port][/app][/playpath]

18.14 md5

MD5 output protocol.

Computes the MD5 hash of the data to be written, and on close writes this to the designated output or stdout if none is specified. It can be used to test muxers without writing an actual file.

Some examples follow.

# Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
ffmpeg -i input.flv -f avi -y md5:output.avi.md5

# Write the MD5 hash of the encoded AVI file to stdout.
ffmpeg -i input.flv -f avi -y md5:

Note that some formats (typically MOV) require the output protocol to be seekable, so they will fail with the MD5 output protocol.

18.15 pipe

UNIX pipe access protocol.

Read and write from UNIX pipes.

The accepted syntax is:

pipe:[number]

number is the number corresponding to the file descriptor of the pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number is not specified, by default the stdout file descriptor will be used for writing, stdin for reading.

For example to read from stdin with ffmpeg:

cat test.wav | ffmpeg -i pipe:0
# ...this is the same as...
cat test.wav | ffmpeg -i pipe:

For writing to stdout with ffmpeg:

ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
# ...this is the same as...
ffmpeg -i test.wav -f avi pipe: | cat > test.avi

This protocol accepts the following options:

blocksize

Set I/O operation maximum block size, in bytes. Default value is INT_MAX, which results in not limiting the requested block size. Setting this value reasonably low improves user termination request reaction time, which is valuable if data transmission is slow.

Note that some formats (typically MOV), require the output protocol to be seekable, so they will fail with the pipe output protocol.

18.16 rtmp

Real-Time Messaging Protocol.

The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia content across a TCP/IP network.

The required syntax is:

rtmp://[username:password@]server[:port][/app][/instance][/playpath]

The accepted parameters are:

username

An optional username (mostly for publishing).

password

An optional password (mostly for publishing).

server

The address of the RTMP server.

port

The number of the TCP port to use (by default is 1935).

app

It is the name of the application to access. It usually corresponds to the path where the application is installed on the RTMP server (e.g. /ondemand/, /flash/live/, etc.). You can override the value parsed from the URI through the rtmp_app option, too.

playpath

It is the path or name of the resource to play with reference to the application specified in app, may be prefixed by "mp4:". You can override the value parsed from the URI through the rtmp_playpath option, too.

listen

Act as a server, listening for an incoming connection.

timeout

Maximum time to wait for the incoming connection. Implies listen.

Additionally, the following parameters can be set via command line options (or in code via AVOptions):

rtmp_app

Name of application to connect on the RTMP server. This option overrides the parameter specified in the URI.

rtmp_buffer

Set the client buffer time in milliseconds. The default is 3000.

rtmp_conn

Extra arbitrary AMF connection parameters, parsed from a string, e.g. like B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0. Each value is prefixed by a single character denoting the type, B for Boolean, N for number, S for string, O for object, or Z for null, followed by a colon. For Booleans the data must be either 0 or 1 for FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or 1 to end or begin an object, respectively. Data items in subobjects may be named, by prefixing the type with ’N’ and specifying the name before the value (i.e. NB:myFlag:1). This option may be used multiple times to construct arbitrary AMF sequences.

rtmp_flashver

Version of the Flash plugin used to run the SWF player. The default is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible; <libavformat version>).)

rtmp_flush_interval

Number of packets flushed in the same request (RTMPT only). The default is 10.

rtmp_live

Specify that the media is a live stream. No resuming or seeking in live streams is possible. The default value is any, which means the subscriber first tries to play the live stream specified in the playpath. If a live stream of that name is not found, it plays the recorded stream. The other possible values are live and recorded.

rtmp_pageurl

URL of the web page in which the media was embedded. By default no value will be sent.

rtmp_playpath

Stream identifier to play or to publish. This option overrides the parameter specified in the URI.

rtmp_subscribe

Name of live stream to subscribe to. By default no value will be sent. It is only sent if the option is specified or if rtmp_live is set to live.

rtmp_swfhash

SHA256 hash of the decompressed SWF file (32 bytes).

rtmp_swfsize

Size of the decompressed SWF file, required for SWFVerification.

rtmp_swfurl

URL of the SWF player for the media. By default no value will be sent.

rtmp_swfverify

URL to player swf file, compute hash/size automatically.

rtmp_tcurl

URL of the target stream. Defaults to proto://host[:port]/app.

For example to read with ffplay a multimedia resource named "sample" from the application "vod" from an RTMP server "myserver":

ffplay rtmp://myserver/vod/sample

To publish to a password protected server, passing the playpath and app names separately:

ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@myserver/

18.17 rtmpe

Encrypted Real-Time Messaging Protocol.

The Encrypted Real-Time Messaging Protocol (RTMPE) is used for streaming multimedia content within standard cryptographic primitives, consisting of Diffie-Hellman key exchange and HMACSHA256, generating a pair of RC4 keys.

18.18 rtmps

Real-Time Messaging Protocol over a secure SSL connection.

The Real-Time Messaging Protocol (RTMPS) is used for streaming multimedia content across an encrypted connection.

18.19 rtmpt

Real-Time Messaging Protocol tunneled through HTTP.

The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used for streaming multimedia content within HTTP requests to traverse firewalls.

18.20 rtmpte

Encrypted Real-Time Messaging Protocol tunneled through HTTP.

The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE) is used for streaming multimedia content within HTTP requests to traverse firewalls.

18.21 rtmpts

Real-Time Messaging Protocol tunneled through HTTPS.

The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used for streaming multimedia content within HTTPS requests to traverse firewalls.

18.22 libsmbclient

libsmbclient permits one to manipulate CIFS/SMB network resources.

Following syntax is required.

smb://[[domain:]user[:password@]]server[/share[/path[/file]]]

This protocol accepts the following options.

timeout

Set timeout in miliseconds of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

truncate

Truncate existing files on write, if set to 1. A value of 0 prevents truncating. Default value is 1.

workgroup

Set the workgroup used for making connections. By default workgroup is not specified.

For more information see: http://www.samba.org/.

18.23 libssh

Secure File Transfer Protocol via libssh

Read from or write to remote resources using SFTP protocol.

Following syntax is required.

sftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg

This protocol accepts the following options.

timeout

Set timeout of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

truncate

Truncate existing files on write, if set to 1. A value of 0 prevents truncating. Default value is 1.

private_key

Specify the path of the file containing private key to use during authorization. By default libssh searches for keys in the ~/.ssh/ directory.

Example: Play a file stored on remote server.

ffplay sftp://user:password@server_address:22/home/user/resource.mpeg

18.24 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte

Real-Time Messaging Protocol and its variants supported through librtmp.

Requires the presence of the librtmp headers and library during configuration. You need to explicitly configure the build with "–enable-librtmp". If enabled this will replace the native RTMP protocol.

This protocol provides most client functions and a few server functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT), encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled variants of these encrypted types (RTMPTE, RTMPTS).

The required syntax is:

rtmp_proto://server[:port][/app][/playpath] options

where rtmp_proto is one of the strings "rtmp", "rtmpt", "rtmpe", "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and server, port, app and playpath have the same meaning as specified for the RTMP native protocol. options contains a list of space-separated options of the form key=val.

See the librtmp manual page (man 3 librtmp) for more information.

For example, to stream a file in real-time to an RTMP server using ffmpeg:

ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream

To play the same stream using ffplay:

ffplay "rtmp://myserver/live/mystream live=1"

18.25 rtp

Real-time Transport Protocol.

The required syntax for an RTP URL is: rtp://hostname[:port][?option=val...]

port specifies the RTP port to use.

The following URL options are supported:

ttl=n

Set the TTL (Time-To-Live) value (for multicast only).

rtcpport=n

Set the remote RTCP port to n.

localrtpport=n

Set the local RTP port to n.

localrtcpport=n'

Set the local RTCP port to n.

pkt_size=n

Set max packet size (in bytes) to n.

connect=0|1

Do a connect() on the UDP socket (if set to 1) or not (if set to 0).

sources=ip[,ip]

List allowed source IP addresses.

block=ip[,ip]

List disallowed (blocked) source IP addresses.

write_to_source=0|1

Send packets to the source address of the latest received packet (if set to 1) or to a default remote address (if set to 0).

localport=n

Set the local RTP port to n.

This is a deprecated option. Instead, localrtpport should be used.

Important notes:

  1. If rtcpport is not set the RTCP port will be set to the RTP port value plus 1.
  2. If localrtpport (the local RTP port) is not set any available port will be used for the local RTP and RTCP ports.
  3. If localrtcpport (the local RTCP port) is not set it will be set to the local RTP port value plus 1.

18.26 rtsp

Real-Time Streaming Protocol.

RTSP is not technically a protocol handler in libavformat, it is a demuxer and muxer. The demuxer supports both normal RTSP (with data transferred over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with data transferred over RDT).

The muxer can be used to send a stream using RTSP ANNOUNCE to a server supporting it (currently Darwin Streaming Server and Mischa Spiegelmock’s RTSP server).

The required syntax for a RTSP url is:

rtsp://hostname[:port]/path

Options can be set on the ffmpeg/ffplay command line, or set in code via AVOptions or in avformat_open_input.

The following options are supported.

initial_pause

Do not start playing the stream immediately if set to 1. Default value is 0.

rtsp_transport

Set RTSP transport protocols.

It accepts the following values:

udp

Use UDP as lower transport protocol.

tcp

Use TCP (interleaving within the RTSP control channel) as lower transport protocol.

udp_multicast

Use UDP multicast as lower transport protocol.

http

Use HTTP tunneling as lower transport protocol, which is useful for passing proxies.

Multiple lower transport protocols may be specified, in that case they are tried one at a time (if the setup of one fails, the next one is tried). For the muxer, only the ‘tcp’ and ‘udp’ options are supported.

rtsp_flags

Set RTSP flags.

The following values are accepted:

filter_src

Accept packets only from negotiated peer address and port.

listen

Act as a server, listening for an incoming connection.

prefer_tcp

Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.

Default value is ‘none’.

allowed_media_types

Set media types to accept from the server.

The following flags are accepted:

video
audio
data

By default it accepts all media types.

min_port

Set minimum local UDP port. Default value is 5000.

max_port

Set maximum local UDP port. Default value is 65000.

timeout

Set maximum timeout (in seconds) to wait for incoming connections.

A value of -1 means infinite (default). This option implies the rtsp_flags set to ‘listen’.

reorder_queue_size

Set number of packets to buffer for handling of reordered packets.

stimeout

Set socket TCP I/O timeout in microseconds.

user-agent

Override User-Agent header. If not specified, it defaults to the libavformat identifier string.

When receiving data over UDP, the demuxer tries to reorder received packets (since they may arrive out of order, or packets may get lost totally). This can be disabled by setting the maximum demuxing delay to zero (via the max_delay field of AVFormatContext).

When watching multi-bitrate Real-RTSP streams with ffplay, the streams to display can be chosen with -vst n and -ast n for video and audio respectively, and can be switched on the fly by pressing v and a.

18.26.1 Examples

The following examples all make use of the ffplay and ffmpeg tools.

18.27 sap

Session Announcement Protocol (RFC 2974). This is not technically a protocol handler in libavformat, it is a muxer and demuxer. It is used for signalling of RTP streams, by announcing the SDP for the streams regularly on a separate port.

18.27.1 Muxer

The syntax for a SAP url given to the muxer is:

sap://destination[:port][?options]

The RTP packets are sent to destination on port port, or to port 5004 if no port is specified. options is a &-separated list. The following options are supported:

announce_addr=address

Specify the destination IP address for sending the announcements to. If omitted, the announcements are sent to the commonly used SAP announcement multicast address 224.2.127.254 (sap.mcast.net), or ff0e::2:7ffe if destination is an IPv6 address.

announce_port=port

Specify the port to send the announcements on, defaults to 9875 if not specified.

ttl=ttl

Specify the time to live value for the announcements and RTP packets, defaults to 255.

same_port=0|1

If set to 1, send all RTP streams on the same port pair. If zero (the default), all streams are sent on unique ports, with each stream on a port 2 numbers higher than the previous. VLC/Live555 requires this to be set to 1, to be able to receive the stream. The RTP stack in libavformat for receiving requires all streams to be sent on unique ports.

Example command lines follow.

To broadcast a stream on the local subnet, for watching in VLC:

ffmpeg -re -i input -f sap sap://224.0.0.255?same_port=1

Similarly, for watching in ffplay:

ffmpeg -re -i input -f sap sap://224.0.0.255

And for watching in ffplay, over IPv6:

ffmpeg -re -i input -f sap sap://[ff0e::1:2:3:4]

18.27.2 Demuxer

The syntax for a SAP url given to the demuxer is:

sap://[address][:port]

address is the multicast address to listen for announcements on, if omitted, the default 224.2.127.254 (sap.mcast.net) is used. port is the port that is listened on, 9875 if omitted.

The demuxers listens for announcements on the given address and port. Once an announcement is received, it tries to receive that particular stream.

Example command lines follow.

To play back the first stream announced on the normal SAP multicast address:

ffplay sap://

To play back the first stream announced on one the default IPv6 SAP multicast address:

ffplay sap://[ff0e::2:7ffe]

18.28 sctp

Stream Control Transmission Protocol.

The accepted URL syntax is:

sctp://host:port[?options]

The protocol accepts the following options:

listen

If set to any value, listen for an incoming connection. Outgoing connection is done by default.

max_streams

Set the maximum number of streams. By default no limit is set.

18.29 srtp

Secure Real-time Transport Protocol.

The accepted options are:

srtp_in_suite
srtp_out_suite

Select input and output encoding suites.

Supported values:

AES_CM_128_HMAC_SHA1_80
SRTP_AES128_CM_HMAC_SHA1_80
AES_CM_128_HMAC_SHA1_32
SRTP_AES128_CM_HMAC_SHA1_32
srtp_in_params
srtp_out_params

Set input and output encoding parameters, which are expressed by a base64-encoded representation of a binary block. The first 16 bytes of this binary block are used as master key, the following 14 bytes are used as master salt.

18.30 subfile

Virtually extract a segment of a file or another stream. The underlying stream must be seekable.

Accepted options:

start

Start offset of the extracted segment, in bytes.

end

End offset of the extracted segment, in bytes.

Examples:

Extract a chapter from a DVD VOB file (start and end sectors obtained externally and multiplied by 2048):

subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB

Play an AVI file directly from a TAR archive:

subfile,,start,183241728,end,366490624,,:archive.tar

18.31 tcp

Transmission Control Protocol.

The required syntax for a TCP url is:

tcp://hostname:port[?options]

options contains a list of &-separated options of the form key=val.

The list of supported options follows.

listen=1|0

Listen for an incoming connection. Default value is 0.

timeout=microseconds

Set raise error timeout, expressed in microseconds.

This option is only relevant in read mode: if no data arrived in more than this time interval, raise error.

listen_timeout=milliseconds

Set listen timeout, expressed in milliseconds.

The following example shows how to setup a listening TCP connection with ffmpeg, which is then accessed with ffplay:

ffmpeg -i input -f format tcp://hostname:port?listen
ffplay tcp://hostname:port

18.32 tls

Transport Layer Security (TLS) / Secure Sockets Layer (SSL)

The required syntax for a TLS/SSL url is:

tls://hostname:port[?options]

The following parameters can be set via command line options (or in code via AVOptions):

ca_file, cafile=filename

A file containing certificate authority (CA) root certificates to treat as trusted. If the linked TLS library contains a default this might not need to be specified for verification to work, but not all libraries and setups have defaults built in. The file must be in OpenSSL PEM format.

tls_verify=1|0

If enabled, try to verify the peer that we are communicating with. Note, if using OpenSSL, this currently only makes sure that the peer certificate is signed by one of the root certificates in the CA database, but it does not validate that the certificate actually matches the host name we are trying to connect to. (With GnuTLS, the host name is validated as well.)

This is disabled by default since it requires a CA database to be provided by the caller in many cases.

cert_file, cert=filename

A file containing a certificate to use in the handshake with the peer. (When operating as server, in listen mode, this is more often required by the peer, while client certificates only are mandated in certain setups.)

key_file, key=filename

A file containing the private key for the certificate.

listen=1|0

If enabled, listen for connections on the provided port, and assume the server role in the handshake instead of the client role.

Example command lines:

To create a TLS/SSL server that serves an input stream.

ffmpeg -i input -f format tls://hostname:port?listen&cert=server.crt&key=server.key

To play back a stream from the TLS/SSL server using ffplay:

ffplay tls://hostname:port

18.33 udp

User Datagram Protocol.

The required syntax for an UDP URL is:

udp://hostname:port[?options]

options contains a list of &-separated options of the form key=val.

In case threading is enabled on the system, a circular buffer is used to store the incoming data, which allows one to reduce loss of data due to UDP socket buffer overruns. The fifo_size and overrun_nonfatal options are related to this buffer.

The list of supported options follows.

buffer_size=size

Set the UDP maximum socket buffer size in bytes. This is used to set either the receive or send buffer size, depending on what the socket is used for. Default is 64KB. See also fifo_size.

localport=port

Override the local UDP port to bind with.

localaddr=addr

Choose the local IP address. This is useful e.g. if sending multicast and the host has multiple interfaces, where the user can choose which interface to send on by specifying the IP address of that interface.

pkt_size=size

Set the size in bytes of UDP packets.

reuse=1|0

Explicitly allow or disallow reusing UDP sockets.

ttl=ttl

Set the time to live value (for multicast only).

connect=1|0

Initialize the UDP socket with connect(). In this case, the destination address can’t be changed with ff_udp_set_remote_url later. If the destination address isn’t known at the start, this option can be specified in ff_udp_set_remote_url, too. This allows finding out the source address for the packets with getsockname, and makes writes return with AVERROR(ECONNREFUSED) if "destination unreachable" is received. For receiving, this gives the benefit of only receiving packets from the specified peer address/port.

sources=address[,address]

Only receive packets sent to the multicast group from one of the specified sender IP addresses.

block=address[,address]

Ignore packets sent to the multicast group from the specified sender IP addresses.

fifo_size=units

Set the UDP receiving circular buffer size, expressed as a number of packets with size of 188 bytes. If not specified defaults to 7*4096.

overrun_nonfatal=1|0

Survive in case of UDP receiving circular buffer overrun. Default value is 0.

timeout=microseconds

Set raise error timeout, expressed in microseconds.

This option is only relevant in read mode: if no data arrived in more than this time interval, raise error.

broadcast=1|0

Explicitly allow or disallow UDP broadcasting.

Note that broadcasting may not work properly on networks having a broadcast storm protection.

18.33.1 Examples

18.34 unix

Unix local socket

The required syntax for a Unix socket URL is:

unix://filepath

The following parameters can be set via command line options (or in code via AVOptions):

timeout

Timeout in ms.

listen

Create the Unix socket in listening mode.

19 Resampler Options

The audio resampler supports the following named options.

Options may be set by specifying -option value in the FFmpeg tools, option=value for the aresample filter, by setting the value explicitly in the SwrContext options or using the libavutil/opt.h API for programmatic use.

ich, in_channel_count

Set the number of input channels. Default value is 0. Setting this value is not mandatory if the corresponding channel layout in_channel_layout is set.

och, out_channel_count

Set the number of output channels. Default value is 0. Setting this value is not mandatory if the corresponding channel layout out_channel_layout is set.

uch, used_channel_count

Set the number of used input channels. Default value is 0. This option is only used for special remapping.

isr, in_sample_rate

Set the input sample rate. Default value is 0.

osr, out_sample_rate

Set the output sample rate. Default value is 0.

isf, in_sample_fmt

Specify the input sample format. It is set by default to none.

osf, out_sample_fmt

Specify the output sample format. It is set by default to none.

tsf, internal_sample_fmt

Set the internal sample format. Default value is none. This will automatically be chosen when it is not explicitly set.

icl, in_channel_layout
ocl, out_channel_layout

Set the input/output channel layout.

See (ffmpeg-utils)the Channel Layout section in the ffmpeg-utils(1) manual for the required syntax.

clev, center_mix_level

Set the center mix level. It is a value expressed in deciBel, and must be in the interval [-32,32].

slev, surround_mix_level

Set the surround mix level. It is a value expressed in deciBel, and must be in the interval [-32,32].

lfe_mix_level

Set LFE mix into non LFE level. It is used when there is a LFE input but no LFE output. It is a value expressed in deciBel, and must be in the interval [-32,32].

rmvol, rematrix_volume

Set rematrix volume. Default value is 1.0.

rematrix_maxval

Set maximum output value for rematrixing. This can be used to prevent clipping vs. preventing volumn reduction A value of 1.0 prevents cliping.

flags, swr_flags

Set flags used by the converter. Default value is 0.

It supports the following individual flags:

res

force resampling, this flag forces resampling to be used even when the input and output sample rates match.

dither_scale

Set the dither scale. Default value is 1.

dither_method

Set dither method. Default value is 0.

Supported values:

rectangular

select rectangular dither

triangular

select triangular dither

triangular_hp

select triangular dither with high pass

lipshitz

select lipshitz noise shaping dither

shibata

select shibata noise shaping dither

low_shibata

select low shibata noise shaping dither

high_shibata

select high shibata noise shaping dither

f_weighted

select f-weighted noise shaping dither

modified_e_weighted

select modified-e-weighted noise shaping dither

improved_e_weighted

select improved-e-weighted noise shaping dither

resampler

Set resampling engine. Default value is swr.

Supported values:

swr

select the native SW Resampler; filter options precision and cheby are not applicable in this case.

soxr

select the SoX Resampler (where available); compensation, and filter options filter_size, phase_shift, filter_type & kaiser_beta, are not applicable in this case.

filter_size

For swr only, set resampling filter size, default value is 32.

phase_shift

For swr only, set resampling phase shift, default value is 10, and must be in the interval [0,30].

linear_interp

Use Linear Interpolation if set to 1, default value is 0.

cutoff

Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float value between 0 and 1. Default value is 0.97 with swr, and 0.91 with soxr (which, with a sample-rate of 44100, preserves the entire audio band to 20kHz).

precision

For soxr only, the precision in bits to which the resampled signal will be calculated. The default value of 20 (which, with suitable dithering, is appropriate for a destination bit-depth of 16) gives SoX’s ’High Quality’; a value of 28 gives SoX’s ’Very High Quality’.

cheby

For soxr only, selects passband rolloff none (Chebyshev) & higher-precision approximation for ’irrational’ ratios. Default value is 0.

async

For swr only, simple 1 parameter audio sync to timestamps using stretching, squeezing, filling and trimming. Setting this to 1 will enable filling and trimming, larger values represent the maximum amount in samples that the data may be stretched or squeezed for each second. Default value is 0, thus no compensation is applied to make the samples match the audio timestamps.

first_pts

For swr only, assume the first pts should be this value. The time unit is 1 / sample rate. This allows for padding/trimming at the start of stream. By default, no assumption is made about the first frame’s expected pts, so no padding or trimming is done. For example, this could be set to 0 to pad the beginning with silence if an audio stream starts after the video stream or to trim any samples with a negative pts due to encoder delay.

min_comp

For swr only, set the minimum difference between timestamps and audio data (in seconds) to trigger stretching/squeezing/filling or trimming of the data to make it match the timestamps. The default is that stretching/squeezing/filling and trimming is disabled (min_comp = FLT_MAX).

min_hard_comp

For swr only, set the minimum difference between timestamps and audio data (in seconds) to trigger adding/dropping samples to make it match the timestamps. This option effectively is a threshold to select between hard (trim/fill) and soft (squeeze/stretch) compensation. Note that all compensation is by default disabled through min_comp. The default is 0.1.

comp_duration

For swr only, set duration (in seconds) over which data is stretched/squeezed to make it match the timestamps. Must be a non-negative double float value, default value is 1.0.

max_soft_comp

For swr only, set maximum factor by which data is stretched/squeezed to make it match the timestamps. Must be a non-negative double float value, default value is 0.

matrix_encoding

Select matrixed stereo encoding.

It accepts the following values:

none

select none

dolby

select Dolby

dplii

select Dolby Pro Logic II

Default value is none.

filter_type

For swr only, select resampling filter type. This only affects resampling operations.

It accepts the following values:

cubic

select cubic

blackman_nuttall

select Blackman Nuttall Windowed Sinc

kaiser

select Kaiser Windowed Sinc

kaiser_beta

For swr only, set Kaiser Window Beta value. Must be an integer in the interval [2,16], default value is 9.

output_sample_bits

For swr only, set number of used output sample bits for dithering. Must be an integer in the interval [0,64], default value is 0, which means it’s not used.

20 See Also

ffprobe, ffmpeg, ffplay, ffserver, ffmpeg-utils, ffmpeg-scaler, ffmpeg-resampler, ffmpeg-codecs, ffmpeg-bitstream-filters, ffmpeg-formats, ffmpeg-devices, ffmpeg-protocols, ffmpeg-filters

21 Authors

The FFmpeg developers.

For details about the authorship, see the Git history of the project (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command git log in the FFmpeg source directory, or browsing the online repository at http://source.ffmpeg.org.

Maintainers for the specific components are listed in the file MAINTAINERS in the source code tree.

This document was generated using makeinfo.