Table of Contents
1 Description
This document describes the supported formats (muxers and demuxers) provided by the libavformat library.
2 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.
max_probe_packets integer (input)
: Set the maximum number of buffered packets when probing a codec.
Default is 2500 packets.
packetsize integer (output)
: Set packet size.
fflags flags
: Set format flags. Some are implemented for a limited number of formats.
Possible values for input files:
‘`discardcorrupt`’
: Discard corrupted packets.
‘`fastseek`’
: Enable fast, but inaccurate seeks for some formats.
‘`genpts`’
: Generate missing PTS if DTS is present.
‘`igndts`’
: Ignore DTS if PTS is also set. In case the PTS is set, the DTS value
is set to NOPTS. This is ignored when the `nofillin` flag is set.
‘`ignidx`’
: Ignore index.
‘`nobuffer`’
: Reduce the latency introduced by buffering during initial input streams analysis.
‘`nofillin`’
: Do not fill in missing values in packet fields that can be exactly calculated.
‘`noparse`’
: Disable AVParsers, this needs `+nofillin` too.
‘`sortdts`’
: Try to interleave output packets by DTS. At present, available only for AVIs with an index.
Possible values for output files:
‘`autobsf`’
: Automatically apply bitstream filters as required by the output format. Enabled by default.
‘`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.
‘`flush_packets`’
: Write out packets immediately.
‘`shortest`’
: Stop muxing at the end of the shortest stream.
It may be needed to increase max\_interleave\_delta to avoid flushing the longer
streams before EOF.
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`’
: Print timestamp information.
‘`id3v2`’
: Print ID3v2 frame data when demuxing files containing ID3v2 tags.
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 10000000 (10 seconds).
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 if set to 1. Default is 0.
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 is -1 (auto), which
means that the underlying protocol will decide, 1 enables it, and has the
effect of reducing the latency, 0 disables it and may increase IO throughput in
some cases.
output_ts_offset offset (output)
: Set the output time offset.
offset must be a time duration specification,
see [the Time duration section in the ffmpeg-utils(1) manual](https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax).
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 indentation:
```
ffprobe -dump_separator "
" -i ~/videos/matrixbench_mpeg2.mpg
```
max_streams integer (input)
: Specifies the maximum number of streams. This can be used to reject files that
would require too many resources due to a large number of streams.
skip_estimate_duration_from_pts bool (input)
: Skip estimation of input duration if it requires an additional probing for PTS at end of file.
At present, applicable for MPEG-PS and MPEG-TS.
duration_probesize integer (input)
: Set probing size, in bytes, for input duration estimation when it actually requires
an additional probing for PTS at end of file (at present: MPEG-PS and MPEG-TS).
It is aimed at users interested in better durations probing for itself, or indirectly
because using the concat demuxer, for example.
The typical use case is an MPEG-TS CBR with a high bitrate, high video buffering and
ending cleaning with similar PTS for video and audio: in such a scenario, the large
physical gap between the last video packet and the last audio packet makes it necessary
to read many bytes in order to get the video stream duration.
Another use case is where the default probing behaviour only reaches a single video frame which is
not the last one of the stream due to frame reordering, so the duration is not accurate.
Setting this option has a performance impact even for small files because the probing
size is fixed.
Default behaviour is a general purpose trade-off, largely adaptive, but the probing size
will not be extended to get streams durations at all costs.
Must be an integer not lesser than 1, or 0 for default behaviour.
strict, f_strict integer (input/output)
: Specify how strictly to follow the standards. f_strict is deprecated and
should be used only via the ffmpeg tool.
Possible values:
‘`very`’
: strictly conform to an 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.
2.1 Format stream specifiers
Format stream specifiers allow selection of one or more streams that match specific properties.
The exact semantics of stream specifiers is defined by the
avformat_match_stream_specifier() function declared in the
libavformat/avformat.h header and documented in the
Stream specifiers section in the ffmpeg(1) manual.
3 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 -demuxers of the ff* tools will display the list of
enabled demuxers. Use -formats to view a combined list of
enabled demuxers and muxers.
The description of some of the currently available demuxers follows.
3.1 aa
Audible Format 2, 3, and 4 demuxer.
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
3.2 aac
Raw Audio Data Transport Stream AAC demuxer.
This demuxer is used to demux an ADTS input containing a single AAC stream alongwith any ID3v1/2 or APE tags in it.
3.3 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. Default is enabled.
-max_fps int
: Maximum framerate in frames per second. Default of 0 imposes no limit.
-default_fps int
: Default framerate in frames per second when none is specified in the file
(0 meaning as fast as possible). Default is 15.
3.4 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.
3.5 astc
ASTC (Adaptive Scalable Texture Compression) demuxer.
This demuxer reads the 16-byte .astc header, hands it to the decoder as
extradata, and emits the compressed image as a single packet.
3.6 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 packets 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.
3.6.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.
To make FFmpeg recognize the format automatically, this directive must
appear 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.
inpoint timestamp
: In point of the file. When the demuxer opens the file it instantly seeks to the
specified timestamp. Seeking is done so that all streams can be presented
successfully at In point.
This directive works best with intra frame codecs, because for non-intra frame
ones you will usually get extra packets before the actual In point and the
decoded content will most likely contain frames before In point too.
For each file, packets before the file In point will have timestamps less than
the calculated start timestamp of the file (negative in case of the first
file), and the duration of the files (if not specified by the `duration`
directive) will be reduced based on their specified In point.
Because of potential packets before the specified In point, packet timestamps
may overlap between two concatenated files.
outpoint timestamp
: Out point of the file. When the demuxer reaches the specified decoding
timestamp in any of the streams, it handles it as an end of file condition and
skips the current and all the remaining packets from all streams.
Out point is exclusive, which means that the demuxer will not output packets
with a decoding timestamp greater or equal to Out point.
This directive works best with intra frame codecs and formats where all streams
are tightly interleaved. For non-intra frame codecs you will usually get
additional packets with presentation timestamp after Out point therefore the
decoded content will most likely contain frames after Out point too. If your
streams are not tightly interleaved you may not get all the packets from all
streams before Out point and you may only will be able to decode the earliest
stream until Out point.
The duration of the files (if not specified by the `duration`
directive) will be reduced based on their specified Out point.
file_packet_metadata key=value
: Metadata of the packets of the file. The specified metadata will be set for
each file packet. You can specify this directive multiple times to add multiple
metadata entries.
This directive is deprecated, use file_packet_meta instead.
file_packet_meta key value
: Metadata of the packets of the file. The specified metadata will be set for
each file packet. You can specify this directive multiple times to add multiple
metadata entries.
option key value
: Option to access, open and probe the file.
Can be present multiple times.
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.
stream_meta key value
: Metadata for the stream.
Can be present multiple times.
stream_codec value
: Codec for the stream.
stream_extradata hex_string
: Extradata for the string, encoded in hexadecimal.
chapter id start end
: Add a chapter. id is an unique identifier, possibly small and
consecutive.
3.6.2 Options
This demuxer accepts the following option:
safe
: If set to 1, reject unsafe file paths and directives.
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.
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.
segment_time_metadata
: If set to 1, every packet will contain the lavf.concat.start_time and the
lavf.concat.duration packet metadata values which are the start_time and
the duration of the respective file segments in the concatenated output
expressed in microseconds. The duration metadata is only set if it is known
based on the concat file.
The default is 0.
chapter_per_file
: If set to 1, add a chapter for each file, named after the title
metadata of the file or, failing that, its file name, and carrying the rest
of the file’s metadata. The files are opened in order when the script is read
to learn their durations, stopping after the first file whose duration is
unknown, which gets the last chapter; when all durations are known, this also
makes the total duration known and the output seekable.
The default is 0.
3.6.3 Examples
- Use absolute filenames and include some comments:
# my first filename
file /mnt/share/file-1.wav
# my second filename including whitespace
file '/mnt/share/file 2.wav'
# my third filename including whitespace plus single quote
file '/mnt/share/file 3'\''.wav'
- Allow for input format auto-probing, use safe filenames and set the duration of
the first file:
``` ffconcat version 1.0
file file-1.wav duration 20.0
file subdir/file-2.wav ```
3.7 dash
Dynamic Adaptive Streaming over HTTP demuxer.
This demuxer presents all AVStreams found in the manifest.
By setting the discard flags on AVStreams the caller can decide
which streams to actually receive.
Each stream mirrors the id and bandwidth properties from the
<Representation> as metadata keys named “id” and “variant_bitrate” respectively.
3.7.1 Options
This demuxer accepts the following option:
cenc_decryption_key
: Default 16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
cenc_decryption_keys
: Dictionary of 16-byte key ID => 16-byte key, both in hex, to decrypt files encrypted using ISO Common Encryption
(CENC/AES-128 CTR; ISO/IEC 23001-7).
3.8 dvdvideo
DVD-Video demuxer, powered by libdvdnav and libdvdread.
Can directly ingest DVD titles, specifically sequential PGCs, into a conversion pipeline. Menu assets, such as background video or audio, can also be demuxed given the menu’s coordinates (at best effort).
Block devices (DVD drives), ISO files, and directory structures are accepted.
Activate with -f dvdvideo in front of one of these inputs.
This demuxer does NOT have decryption code of any kind. You are on your own working with encrypted DVDs, and should not expect support on the matter.
Underlying playback is handled by libdvdnav, and structure parsing by libdvdread.
FFmpeg must be built with GPL library support available as well as the
configure switches --enable-libdvdnav and --enable-libdvdread.
You will need to provide either the desired “title number” or exact PGC/PG coordinates. Many open-source DVD players and tools can aid in providing this information. If not specified, the demuxer will default to title 1 which works for many discs. However, due to the flexibility of the format, it is recommended to check manually. There are many discs that are authored strangely or with invalid headers.
If the input is a real DVD drive, please note that there are some drives which may silently fail on reading bad sectors from the disc, returning random bits instead which is effectively corrupt data. This is especially prominent on aging or rotting discs. A second pass and integrity checks would be needed to detect the corruption. This is not an FFmpeg issue.
3.8.1 Background
DVD-Video is not a directly accessible, linear container format in the traditional sense. Instead, it allows for complex and programmatic playback of carefully muxed MPEG-PS streams that are stored in headerless VOB files. To the end-user, these streams are known simply as “titles”, but the actual logical playback sequence is defined by one or more “PGCs”, or Program Group Chains, within the title. The PGC is in turn comprised of multiple “PGs”, or Programs“, which are the actual video segments (and for a typical video feature, sequentially ordered). The PGC structure, along with stream layout and metadata, are stored in IFO files that need to be parsed. PGCs can be thought of as playlists in easier terms.
An actual DVD player relies on user GUI interaction via menus and an internal VM to drive the direction of demuxing. Generally, the user would either navigate (via menus) or automatically be redirected to the PGC of their choice. During this process and the subsequent playback, the DVD player’s internal VM also maintains a state and executes instructions that can create jumps to different sectors during playback. This is why libdvdnav is involved, as a linear read of the MPEG-PS blobs on the disc (VOBs) is not enough to produce the right sequence in many cases.
There are many other DVD structures (a long subject) that will not be discussed here. NAV packets, in particular, are handled by this demuxer to build accurate timing but not emitted as a stream. For a good high-level understanding, refer to:
3.8.2 Options
This demuxer accepts the following options:
title int
: The title number to play. Must be set if pgc and pg are not set.
Not applicable to menus.
Default is 0 (auto), which currently only selects the first available title (title 1)
and notifies the user about the implications.
chapter_start int
: The chapter, or PTT (part-of-title), number to start at. Not applicable to menus.
Default is 1.
chapter_end int
: The chapter, or PTT (part-of-title), number to end at. Not applicable to menus.
Default is 0, which is a special value to signal end at the last possible chapter.
angle int
: The video angle number, referring to what is essentially an additional
video stream that is composed from alternate frames interleaved in the VOBs.
Not applicable to menus.
Default is 1.
region int
: The region code to use for playback. Some discs may use this to default playback
at a particular angle in different regions. This option will not affect the region code
of a real DVD drive, if used as an input. Not applicable to menus.
Default is 0, “world”.
menu bool
: Demux menu assets instead of navigating a title. Requires exact coordinates
of the menu (menu_lu, menu_vts, pgc, pg).
Default is false.
menu_lu int
: The menu language to demux. In DVD, menus are grouped by language.
Default is 1, the first language unit.
menu_vts int
: The VTS where the menu lives, or 0 if it is a VMG menu (root-level).
Default is 1, menu of the first VTS.
pgc int
: The entry PGC to start playback, in conjunction with pg.
Alternative to setting title.
Chapter markers are not supported at this time.
Must be explicitly set for menus.
Default is 0, automatically resolve from value of title.
pg int
: The entry PG to start playback, in conjunction with pgc.
Alternative to setting title.
Chapter markers are not supported at this time.
Default is 1, the first PG of the PGC.
preindex bool
: Enable this to have accurate chapter (PTT) markers and duration measurement,
which requires a slow second pass read in order to index the chapter marker
timestamps from NAV packets. This is non-ideal extra work for real optical drives.
It is recommended and faster to use this option with a backup of the DVD structure
stored on a hard drive. Not compatible with pgc and pg.
Default is 0, false.
trim bool
: Skip padding cells (i.e. cells shorter than 1 second) from the beginning.
There exist many discs with filler segments at the beginning of the PGC,
often with junk data intended for controlling a real DVD player’s
buffering speed and with no other material data value.
Not applicable to menus.
Default is 1, true.
3.8.3 Examples
- Open title 3 from a given DVD structure:
ffmpeg -f dvdvideo -title 3 -i <path to DVD> ...
- Open chapters 3-6 from title 1 from a given DVD structure:
ffmpeg -f dvdvideo -chapter_start 3 -chapter_end 6 -title 1 -i <path to DVD> ...
- Open only chapter 5 from title 1 from a given DVD structure:
ffmpeg -f dvdvideo -chapter_start 5 -chapter_end 5 -title 1 -i <path to DVD> ...
- Demux menu with language 1 from VTS 1, PGC 1, starting at PG 1:
ffmpeg -f dvdvideo -menu 1 -menu_lu 1 -menu_vts 1 -pgc 1 -pg 1 -i <path to DVD> ...
3.9 ea
Electronic Arts Multimedia format demuxer.
This format is used by various Electronic Arts games.
3.9.1 Options
merge_alpha bool
: Normally the VP6 alpha channel (if exists) is returned as a secondary video
stream, by setting this option you can make the demuxer return a single video
stream which contains the alpha channel in addition to the ordinary video.
3.10 imf
Interoperable Master Format demuxer.
This demuxer presents audio and video streams found in an IMF Composition, as specified in SMPTE ST 2067-2.
ffmpeg [-assetmaps <path of ASSETMAP1>,<path of ASSETMAP2>,...] -i <path of CPL> ...
If -assetmaps is not specified, the demuxer looks for a file called
ASSETMAP.xml in the same directory as the CPL.
3.11 flv, live_flv, kux
Adobe Flash Video Format demuxer.
This demuxer is used to demux FLV files and RTMP network streams. In case of live network streams, if you force format, you may use live_flv option instead of flv to survive timestamp discontinuities. KUX is a flv variant used on the Youku platform.
ffmpeg -f flv -i myfile.flv ...
ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
-flv_metadata bool
: Allocate the streams according to the onMetaData array content.
-flv_ignore_prevtag bool
: Ignore the size of previous tag value.
-flv_full_metadata bool
: Output all context of the onMetadata.
3.12 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.
3.13 hls
HLS demuxer
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”. It is unset when the stream is shared by variants with different bitrates. The value is always available in the corresponding program’s metadata.
It accepts the following options:
live_start_index
: segment index to start live streams at (negative values are from the end).
prefer_x_start
: prefer to use #EXT-X-START if it’s in playlist instead of live_start_index.
allowed_extensions
: ’,’ separated list of file extensions that hls is allowed to access.
extension_picky
: This blocks disallowed extensions from probing
It also requires all available segments to have matching extensions to the format
except mpegts, which is always allowed.
It is recommended to set the whitelists correctly instead of depending on extensions
Enabled by default.
max_reload
: Maximum number of times a insufficient list is attempted to be reloaded.
Default value is 1000.
m3u8_hold_counters
: The maximum number of times to load m3u8 when it refreshes without new segments.
Default value is 1000.
http_persistent
: Use persistent HTTP connections. Applicable only for HTTP streams.
Enabled by default.
http_multiple
: Use multiple HTTP connections for downloading HTTP segments.
Enabled by default for HTTP/1.1 servers.
http_seekable
: Use HTTP partial requests for downloading HTTP segments.
0 = disable, 1 = enable, -1 = auto, Default is auto.
seg_format_options
: Set options for the demuxer of media segments using a list of key=value pairs separated by :.
seg_max_retry
: Maximum number of times to reload a segment on error, useful when segment skip on network error is not desired.
Default value is 0.
3.14 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.
Default value is 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.
export_path_metadata
: If set to 1, will add two extra fields to the metadata found in input, making them
also available for other filters (see drawtext filter for examples). Default
value is 0. The extra fields are described below:
`lavf.image2dec.source_path`
: Corresponds to the full path to the input file being read.
`lavf.image2dec.source_basename`
: Corresponds to the name of the file being read.
3.14.1 Examples
- Use
ffmpegfor creating a video from the images in the file sequenceimg-001.jpeg,img-002.jpeg, ..., assuming an input frame rate of 10 frames per second:
ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
- As above, but start by reading from a file with index 100 in the sequence:
ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
- Read images matching the “*.png” glob pattern , that is all the files
terminating with the “.png” suffix:
ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
3.15 jpeg_mpf
JPEG Multi-Picture Format demuxer.
Exposes each JPEG image stored in a CIPA DC-007 MP file as a separate stream,
in the order of the MP Entries, with the First Individual Image flagged as the
default stream. If the file contains an ISO 21496-1 gain map, as is the case
for JPEG Ultra HDR, the primary image and the gain map are linked by a
‘gain_map’ stream group, and the gain map parameters are exported as
frame side data by the decoder.
Images of any other type (e.g. large thumbnails or multi-view images) are exposed as additional streams.
This demuxer accepts the following options, which behave like the options of
the same name of the ‘image2’ demuxer:
framerate
: Set the frame rate of the video streams. The default is 25.
loop
: If set to 1, loop over the images in the file. The default is 0. This requires
seekable input.
3.16 ktx
Khronos Texture 1.0 demuxer for ASTC textures.
This demuxer reads the KTX 1.0 header and maps the ASTC GL internal format to
the block footprint the decoder needs, so only files using the ASTC formats
are accepted. A KTXorientation key is preserved as stream display
metadata, and the texture is emitted as a single packet.
3.17 libgme
The Game Music Emu library is a collection of video game music file emulators.
See <https://bitbucket.org/mpyne/game-music-emu/overview> for more information.
It accepts the following options:
track_index
: Set the index of which track to demux. The demuxer can only export one track.
Track indexes start at 0. Default is to pick the first track. Number of tracks
is exported as tracks metadata entry.
sample_rate
: Set the sampling rate of the exported track. Range is 1000 to 999999. Default is 44100.
max_size (bytes)
: The demuxer buffers the entire file into memory. Adjust this value to set the maximum buffer size,
which in turn, acts as a ceiling for the size of files that can be read.
Default is 50 MiB.
3.18 libmodplug
ModPlug based module demuxer
See <https://github.com/Konstanty/libmodplug>
It will export one 2-channel 16-bit 44.1 kHz audio stream.
Optionally, a pal8 16-color video stream can be exported with or without printed metadata.
It accepts the following options:
noise_reduction
: Apply a simple low-pass filter. Can be 1 (on) or 0 (off). Default is 0.
reverb_depth
: Set amount of reverb. Range 0-100. Default is 0.
reverb_delay
: Set delay in ms, clamped to 40-250 ms. Default is 0.
bass_amount
: Apply bass expansion a.k.a. XBass or megabass. Range is 0 (quiet) to 100 (loud). Default is 0.
bass_range
: Set cutoff i.e. upper-bound for bass frequencies. Range is 10-100 Hz. Default is 0.
surround_depth
: Apply a Dolby Pro-Logic surround effect. Range is 0 (quiet) to 100 (heavy). Default is 0.
surround_delay
: Set surround delay in ms, clamped to 5-40 ms. Default is 0.
max_size
: The demuxer buffers the entire file into memory. Adjust this value to set the maximum buffer size,
which in turn, acts as a ceiling for the size of files that can be read. Range is 0 to 100 MiB.
0 removes buffer size limit (not recommended). Default is 5 MiB.
video_stream_expr
: String which is evaluated using the eval API to assign colors to the generated video stream.
Variables which can be used are x, y, w, h, t, speed,
tempo, order, pattern and row.
video_stream
: Generate video stream. Can be 1 (on) or 0 (off). Default is 0.
video_stream_w
: Set video frame width in ’chars’ where one char indicates 8 pixels. Range is 20-512. Default is 30.
video_stream_h
: Set video frame height in ’chars’ where one char indicates 8 pixels. Range is 20-512. Default is 30.
video_stream_ptxt
: Print metadata on video stream. Includes speed, tempo, order, pattern,
row and ts (time in ms). Can be 1 (on) or 0 (off). Default is 1.
3.19 libopenmpt
libopenmpt based module demuxer
See <https://lib.openmpt.org/libopenmpt/> for more information.
Some files have multiple subsongs (tracks) this can be set with the subsong
option.
It accepts the following options:
subsong
: Set the subsong index. This can be either ’all’, ’auto’, or the index of the
subsong. Subsong indexes start at 0. The default is ’auto’.
The default value is to let libopenmpt choose.
layout
: Set the channel layout. Valid values are 1, 2, and 4 channel layouts.
The default value is STEREO.
sample_rate
: Set the sample rate for libopenmpt to output.
Range is from 1000 to INT_MAX. The value default is 48000.
3.20 mcc
Demuxer for MacCaption MCC files, it supports MCC versions 1.0 and 2.0.
MCC files store VANC data, which can include closed captions (EIA-608 and CEA-708), ancillary time code, pan-scan data, etc.
By default, for backward compatibility, the MCC demuxer extracts just the EIA-608 and CEA-708 closed captions and returns a EIA_608 stream, ignoring all other VANC data.
You can change it to return all VANC data in a SMPTE_436M_ANC data stream by setting -eia608_extract 0
3.20.1 Examples
- Convert a MCC file to Scenarist (SCC) format:
ffmpeg -i CC.mcc -c:s copy CC.scc
Note that the SCC format only supports EIA-608, so this will discard all other data such as CEA-708 extensions. - Merge a MCC file into a MXF file:
ffmpeg -i video_and_audio.mxf -eia608_extract 0 -i CC.mcc -c copy -map 0 -map 1 out.mxf
This retains all VANC data and inserts it into the output MXF file as a SMPTE_436M_ANC data stream.
3.21 mov/mp4/3gp
Demuxer for Quicktime File Format & ISO/IEC Base Media File Format (ISO/IEC 14496-12 or MPEG-4 Part 12, ISO/IEC 15444-12 or JPEG 2000 Part 12).
Registered extensions: mov, mp4, m4a, 3gp, 3g2, mj2, psp, m4b, ism, ismv, isma, f4v
3.21.1 Options
This demuxer accepts the following options:
enable_drefs
: Enable loading of external tracks, disabled by default.
Enabling this can theoretically leak information in some use cases.
use_absolute_path
: Allows loading of external tracks via absolute paths, disabled by default.
Enabling this poses a security risk. It should only be enabled if the source
is known to be non-malicious.
seek_streams_individually
: When seeking, identify the closest point in each stream individually and demux packets in
that stream from identified point. This can lead to a different sequence of packets compared
to demuxing linearly from the beginning. Default is true.
ignore_editlist
: Ignore any edit list atoms. The demuxer, by default, modifies the stream index to reflect the
timeline described by the edit list. Default is false.
advanced_editlist
: Modify the stream index to reflect the timeline described by the edit list. ignore_editlist
must be set to false for this option to be effective.
If both ignore_editlist and this option are set to false, then only the
start of the stream index is modified to reflect initial dwell time or starting timestamp
described by the edit list. Default is true.
ignore_chapters
: Don’t parse chapters. This includes GoPro ’HiLight’ tags/moments. Note that chapters are
only parsed when input is seekable. Default is false.
use_mfra_for
: For seekable fragmented input, set fragment’s starting timestamp from media fragment random access box, if present.
Following options are available:
‘`auto`’
: Auto-detect whether to set mfra timestamps as PTS or DTS *(default)*
‘`dts`’
: Set mfra timestamps as DTS
‘`pts`’
: Set mfra timestamps as PTS
‘`0`’
: Don’t use mfra box to set timestamps
(本文超出站点单文档体积上限,已截断)
