2011-01-09 10:22:21 +00:00
@chapter Demuxers
@c man begin DEMUXERS
2013-08-10 02:19:53 +00:00
Demuxers are configured elements in FFmpeg that can read the
2011-01-09 10:22:21 +00:00
multimedia streams from a particular type of file.
2011-03-17 15:55:58 +00:00
When you configure your FFmpeg build, all the supported demuxers
2011-01-09 10:22:21 +00:00
are enabled by default. You can list all available ones using the
2013-02-12 18:15:51 +00:00
configure option @code{--list-demuxers}.
2011-01-09 10:22:21 +00:00
You can disable all the demuxers using the configure option
2013-02-12 18:15:51 +00:00
@code{--disable-demuxers}, and selectively enable a single demuxer with
the option @code{--enable-demuxer=@var{DEMUXER}}, or disable it
with the option @code{--disable-demuxer=@var{DEMUXER}}.
2011-01-09 10:22:21 +00:00
2017-02-10 11:40:14 +00:00
The option @code{-demuxers} of the ff* tools will display the list of
enabled demuxers. Use @code{-formats} to view a combined list of
enabled demuxers and muxers.
2011-01-09 10:22:21 +00:00
The description of some of the currently available demuxers follows.
2015-07-19 21:16:36 +00:00
@section aa
Audible Format 2, 3, and 4 demuxer.
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
2014-11-25 09:03:12 +00:00
@section 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.
@table @option
@item -ignore_loop @var{bool}
2021-06-13 11:37:03 +00:00
Ignore the loop variable in the file if set. Default is enabled.
2014-11-25 09:03:12 +00:00
@item -max_fps @var{int}
2021-06-13 11:37:03 +00:00
Maximum framerate in frames per second. Default of 0 imposes no limit.
2014-11-25 09:03:12 +00:00
@item -default_fps @var{int}
Default framerate in frames per second when none is specified in the file
2021-06-13 11:37:03 +00:00
(0 meaning as fast as possible). Default is 15.
2014-11-25 09:03:12 +00:00
@end table
2013-08-28 11:03:09 +00:00
@section asf
Advanced Systems Format demuxer.
This demuxer is used to demux ASF files and MMS network streams.
@table @option
@item -no_resync_search @var{bool}
Do not try to resynchronize by looking for a certain optional start code.
@end table
2013-02-21 18:33:26 +00:00
@anchor{concat}
2013-02-08 23:45:05 +00:00
@section concat
Virtual concatenation script demuxer.
This demuxer reads a list of files and other directives from a text file and
2016-10-09 18:51:57 +00:00
demuxes them one after the other, as if all their packets had been muxed
2013-02-08 23:45:05 +00:00
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.).
2013-03-05 16:14:27 +00:00
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
@code{duration} directive can be used to override the duration stored in
each file.
2013-02-08 23:45:05 +00:00
@subsection 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:
@table @option
@item @code{file @var{path}}
Path to a file to read; special characters and spaces must be escaped with
backslash or single quotes.
2014-02-26 19:22:46 +00:00
All subsequent file-related directives apply to that file.
2013-02-13 16:25:56 +00:00
2013-02-03 09:22:57 +00:00
@item @code{ffconcat version 1.0}
2021-07-28 10:38:08 +00:00
Identify the script type and version.
2013-02-03 09:22:57 +00:00
2013-02-03 09:27:11 +00:00
To make FFmpeg recognize the format automatically, this directive must
2016-10-09 18:51:57 +00:00
appear exactly as is (no extra space or byte-order-mark) on the very first
2013-02-03 09:27:11 +00:00
line of the script.
2013-02-13 16:25:56 +00:00
@item @code{duration @var{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.
2013-02-14 15:00:06 +00:00
If the duration is set for all files, then it is possible to seek in the
whole concatenated video.
2015-07-02 17:56:25 +00:00
@item @code{inpoint @var{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 @code{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.
2015-07-02 18:35:04 +00:00
@item @code{outpoint @var{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 @code{duration}
directive) will be reduced based on their specified Out point.
2015-07-02 21:20:09 +00:00
@item @code{file_packet_metadata @var{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.
2021-07-28 10:34:19 +00:00
@item @code{option @var{key} @var{value}}
Option to access, open and probe the file.
Can be present multiple times.
2014-02-26 19:22:46 +00:00
@item @code{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.
@item @code{exact_stream_id @var{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.
2013-02-08 23:45:05 +00:00
@end table
2013-02-03 09:16:33 +00:00
@subsection Options
This demuxer accepts the following option:
@table @option
@item safe
2021-07-28 10:38:08 +00:00
If set to 1, reject unsafe file paths and directives.
A file path is considered safe if it
2013-02-03 09:16:33 +00:00
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.
2016-01-19 21:13:14 +00:00
The default is 1.
2014-04-14 11:49:12 +00:00
@item auto_convert
If set to 1, try to perform automatic conversions on packet data to make the
streams concatenable.
2015-05-26 20:16:43 +00:00
The default is 1.
2014-04-14 11:49:12 +00:00
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.
2015-10-24 15:16:11 +00:00
@item segment_time_metadata
If set to 1, every packet will contain the @var{lavf.concat.start_time} and the
@var{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.
2013-02-03 09:16:33 +00:00
@end table
2016-01-26 08:02:51 +00:00
@subsection Examples
@itemize
@item
Use absolute filenames and include some comments:
@example
# 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'
@end example
@item
Allow for input format auto-probing, use safe filenames and set the duration of
the first file:
@example
ffconcat version 1.0
file file-1.wav
duration 20.0
file subdir/file-2.wav
@end example
@end itemize
2018-01-14 14:34:43 +00:00
@section 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 @code{id} and @code{bandwidth} properties from the
@code{<Representation>} as metadata keys named "id" and "variant_bitrate" respectively.
2021-03-31 09:46:12 +00:00
@section flv, live_flv, kux
2013-08-28 09:55:03 +00:00
Adobe Flash Video Format demuxer.
2016-12-23 23:21:23 +00:00
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.
2021-03-31 09:46:12 +00:00
KUX is a flv variant used on the Youku platform.
2016-12-23 23:21:23 +00:00
@example
ffmpeg -f flv -i myfile.flv ...
ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
@end example
2013-08-28 09:55:03 +00:00
@table @option
2013-08-28 11:03:09 +00:00
@item -flv_metadata @var{bool}
2013-08-28 09:55:03 +00:00
Allocate the streams according to the onMetaData array content.
2018-08-07 07:48:23 +00:00
@item -flv_ignore_prevtag @var{bool}
Ignore the size of previous tag value.
2018-08-07 07:51:36 +00:00
@item -flv_full_metadata @var{bool}
Output all context of the onMetadata.
2013-08-28 09:55:03 +00:00
@end table
2014-08-29 00:26:11 +00:00
@section gif
Animated GIF demuxer.
It accepts the following options:
@table @option
@item min_delay
Set the minimum valid delay between frames in hundredths of seconds.
Range is 0 to 6000. Default value is 2.
2015-03-29 03:14:48 +00:00
@item 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.
2014-08-29 00:26:11 +00:00
@item default_delay
Set the default delay between frames in hundredths of seconds.
Range is 0 to 6000. Default value is 10.
@item ignore_loop
GIF files can contain information to loop a certain number of times (or
infinitely). If @option{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.
@end table
For example, with the overlay filter, place an infinitely looping GIF
over another video:
@example
ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
@end example
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 @file{input.mp4} as the GIF in this example loops
infinitely.
2017-08-25 23:26:58 +00:00
@section hls
HLS demuxer
2019-04-12 10:54:47 +00:00
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".
2017-08-25 23:26:58 +00:00
It accepts the following options:
@table @option
@item live_start_index
segment index to start live streams at (negative values are from the end).
@item allowed_extensions
',' separated list of file extensions that hls is allowed to access.
@item max_reload
Maximum number of times a insufficient list is attempted to be reloaded.
Default value is 1000.
2017-10-04 21:52:52 +00:00
2019-11-18 09:37:00 +00:00
@item m3u8_hold_counters
2019-11-27 11:04:00 +00:00
The maximum number of times to load m3u8 when it refreshes without new segments.
2019-11-18 09:37:00 +00:00
Default value is 1000.
2017-10-04 21:52:52 +00:00
@item http_persistent
Use persistent HTTP connections. Applicable only for HTTP streams.
Enabled by default.
2017-12-12 23:25:46 +00:00
@item http_multiple
Use multiple HTTP connections for downloading HTTP segments.
2017-12-26 04:37:55 +00:00
Enabled by default for HTTP/1.1 servers.
2019-08-07 16:12:16 +00:00
@item http_seekable
Use HTTP partial requests for downloading HTTP segments.
0 = disable, 1 = enable, -1 = auto, Default is auto.
2021-05-29 09:57:18 +00:00
@item seg_format_options
Set options for the demuxer of media segments using a list of key=value pairs separated by @code{:}.
2017-08-25 23:26:58 +00:00
@end table
2011-01-09 10:22:23 +00:00
@section image2
Image file demuxer.
This demuxer reads from a list of image files specified by a pattern.
2012-08-06 12:54:06 +00:00
The syntax and meaning of the pattern is specified by the
option @var{pattern_type}.
2011-01-09 10:22:23 +00:00
2012-08-06 12:54:06 +00:00
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:
@table @option
@item framerate
2013-03-30 18:55:47 +00:00
Set the frame rate for the video stream. It defaults to 25.
2012-08-06 12:54:06 +00:00
@item loop
If set to 1, loop over the input. Default value is 0.
@item pattern_type
Select the pattern type used to interpret the provided filename.
@var{pattern_type} accepts one of the following values.
@table @option
2015-05-12 00:22:02 +00:00
@item 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.
2012-08-06 12:54:06 +00:00
@item 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 "%0@var{N}d", which
2011-01-21 12:54:14 +00:00
specifies the position of the characters representing a sequential
2011-01-09 10:22:23 +00:00
number in each filename matched by the pattern. If the form
"%d0@var{N}d" is used, the string representing the number in each
filename is 0-padded and @var{N} is the total number of 0-padded
digits representing the number. The literal character '%' can be
specified in the pattern with the string "%%".
2012-08-06 12:54:06 +00:00
If the sequence pattern contains "%d" or "%0@var{N}d", the first filename of
2011-01-21 12:54:14 +00:00
the file list specified by the pattern must contain a number
2012-08-04 11:04:40 +00:00
inclusively contained between @var{start_number} and
2012-08-05 08:04:02 +00:00
@var{start_number}+@var{start_number_range}-1, and all the following
numbers must be sequential.
2011-01-09 10:22:23 +00:00
For example the pattern "img-%03d.bmp" will match a sequence of
filenames of the form @file{img-001.bmp}, @file{img-002.bmp}, ...,
@file{img-010.bmp}, etc.; the pattern "i%%m%%g-%d.jpg" will match a
sequence of filenames of the form @file{i%m%g-1.jpg},
@file{i%m%g-2.jpg}, ..., @file{i%m%g-10.jpg}, etc.
2012-08-06 12:54:06 +00:00
Note that the pattern must not necessarily contain "%d" or
"%0@var{N}d", for example to convert a single image file
@file{img.jpeg} you can employ the command:
@example
ffmpeg -i img.jpeg img.png
@end example
2011-01-09 10:22:23 +00:00
2012-08-06 12:54:06 +00:00
@item glob
Select a glob wildcard pattern type.
The pattern is interpreted like a @code{glob()} pattern. This is only
selectable if libavformat was compiled with globbing support.
@item glob_sequence @emph{(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
@code{%*?[]@{@}} that is preceded by an unescaped "%", the pattern is
interpreted like a @code{glob()} pattern, otherwise it is interpreted
like a sequence pattern.
All glob special characters @code{%*?[]@{@}} must be prefixed
with "%". To escape a literal "%" you shall use "%%".
For example the pattern @code{foo-%*.jpeg} will match all the
filenames prefixed by "foo-" and terminating with ".jpeg", and
@code{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 @var{glob} and
@var{sequence}.
@end table
Default value is @var{glob_sequence}.
2012-08-04 11:04:40 +00:00
@item 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.
@item start_number
Set the index of the file matched by the image file pattern to start
to read from. Default value is 0.
2012-08-05 08:04:02 +00:00
@item start_number_range
Set the index interval range to check when looking for the first image
file in the sequence, starting from @var{start_number}. Default value
is 5.
2013-05-24 13:50:36 +00:00
@item 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.
2013-05-25 13:34:27 +00:00
If set to 2, will set frame timestamp to the modification time of the image file in
2014-04-14 20:35:25 +00:00
nanosecond precision.
2012-08-04 11:04:40 +00:00
@item 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.
2020-01-01 16:57:02 +00:00
@item 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 @var{drawtext} filter for examples). Default
value is 0. The extra fields are described below:
@table @option
@item lavf.image2dec.source_path
Corresponds to the full path to the input file being read.
@item lavf.image2dec.source_basename
Corresponds to the name of the file being read.
@end table
2012-08-04 11:04:40 +00:00
@end table
2012-08-04 16:33:19 +00:00
@subsection Examples
@itemize
@item
Use @command{ffmpeg} for creating a video from the images in the file
sequence @file{img-001.jpeg}, @file{img-002.jpeg}, ..., assuming an
input frame rate of 10 frames per second:
2011-01-09 10:22:23 +00:00
@example
2013-09-29 16:36:25 +00:00
ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
2011-01-09 10:22:23 +00:00
@end example
2012-08-04 16:33:19 +00:00
@item
2012-08-04 11:04:40 +00:00
As above, but start by reading from a file with index 100 in the sequence:
@example
2013-09-29 16:36:25 +00:00
ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
2012-08-04 11:04:40 +00:00
@end example
2012-08-06 12:54:06 +00:00
@item
Read images matching the "*.png" glob pattern , that is all the files
terminating with the ".png" suffix:
2011-01-21 12:54:14 +00:00
@example
2013-09-29 16:36:25 +00:00
ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
2011-01-21 12:54:14 +00:00
@end example
2012-08-06 12:54:06 +00:00
@end itemize
2011-01-21 12:54:14 +00:00
2016-10-13 15:47:49 +00:00
@section libgme
The Game Music Emu library is a collection of video game music file emulators.
2018-12-04 12:35:53 +00:00
See @url{https://bitbucket.org/mpyne/game-music-emu/overview} for more information.
2016-10-13 15:47:49 +00:00
2018-12-04 12:35:53 +00:00
It accepts the following options:
@table @option
@item 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 @var{tracks} metadata entry.
2016-10-13 15:47:49 +00:00
2018-12-04 12:35:53 +00:00
@item sample_rate
Set the sampling rate of the exported track. Range is 1000 to 999999. Default is 44100.
@item max_size @emph{(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.
@end table
2016-10-13 15:47:49 +00:00
2018-12-05 14:02:05 +00:00
@section libmodplug
ModPlug based module demuxer
See @url{https://github.com/Konstanty/libmodplug}
It will export one 2-channel 16-bit 44.1 kHz audio stream.
Optionally, a @code{pal8} 16-color video stream can be exported with or without printed metadata.
It accepts the following options:
@table @option
@item noise_reduction
Apply a simple low-pass filter. Can be 1 (on) or 0 (off). Default is 0.
@item reverb_depth
Set amount of reverb. Range 0-100. Default is 0.
@item reverb_delay
Set delay in ms, clamped to 40-250 ms. Default is 0.
@item bass_amount
Apply bass expansion a.k.a. XBass or megabass. Range is 0 (quiet) to 100 (loud). Default is 0.
@item bass_range
Set cutoff i.e. upper-bound for bass frequencies. Range is 10-100 Hz. Default is 0.
@item surround_depth
Apply a Dolby Pro-Logic surround effect. Range is 0 (quiet) to 100 (heavy). Default is 0.
@item surround_delay
Set surround delay in ms, clamped to 5-40 ms. Default is 0.
@item 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.
@item 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 @code{x}, @code{y}, @code{w}, @code{h}, @code{t}, @code{speed},
@code{tempo}, @code{order}, @code{pattern} and @code{row}.
@item video_stream
Generate video stream. Can be 1 (on) or 0 (off). Default is 0.
@item video_stream_w
Set video frame width in 'chars' where one char indicates 8 pixels. Range is 20-512. Default is 30.
@item video_stream_h
Set video frame height in 'chars' where one char indicates 8 pixels. Range is 20-512. Default is 30.
@item video_stream_ptxt
Print metadata on video stream. Includes @code{speed}, @code{tempo}, @code{order}, @code{pattern},
@code{row} and @code{ts} (time in ms). Can be 1 (on) or 0 (off). Default is 1.
@end table
2016-10-13 15:47:49 +00:00
@section libopenmpt
libopenmpt based module demuxer
See @url{https://lib.openmpt.org/libopenmpt/} for more information.
Some files have multiple subsongs (tracks) this can be set with the @option{subsong}
option.
It accepts the following options:
@table @option
@item 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.
@item layout
Set the channel layout. Valid values are 1, 2, and 4 channel layouts.
The default value is STEREO.
@item sample_rate
Set the sample rate for libopenmpt to output.
Range is from 1000 to INT_MAX. The value default is 48000.
@end table
2020-01-26 15:02:18 +00:00
@section mov/mp4/3gp
2016-01-20 15:49:43 +00:00
2020-01-26 15:02:18 +00:00
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
@subsection Options
2016-01-20 15:49:43 +00:00
This demuxer accepts the following options:
@table @option
@item enable_drefs
Enable loading of external tracks, disabled by default.
Enabling this can theoretically leak information in some use cases.
@item 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
2020-01-26 15:02:18 +00:00
is known to be non-malicious.
@item 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.
@item 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.
@item advanced_editlist
Modify the stream index to reflect the timeline described by the edit list. @code{ignore_editlist}
must be set to false for this option to be effective.
If both @code{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.
@item 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.
@item use_mfra_for
For seekable fragmented input, set fragment's starting timestamp from media fragment random access box, if present.
Following options are available:
@table @samp
@item auto
Auto-detect whether to set mfra timestamps as PTS or DTS @emph{(default)}
@item dts
Set mfra timestamps as DTS
@item pts
Set mfra timestamps as PTS
2016-01-20 15:49:43 +00:00
2020-01-26 15:02:18 +00:00
@item 0
Don't use mfra box to set timestamps
2016-01-20 15:49:43 +00:00
@end table
2021-05-29 08:57:34 +00:00
@item use_tfdt
For fragmented input, set fragment's starting timestamp to @code{baseMediaDecodeTime} from the @code{tfdt} box.
Default is disabled, which will preferentially use the @code{earliest_presentation_time} from the @code{sidx} box.
In either case, the timestamp from the @code{mfra} box will be used if it's available and @code{use_mfra_for} is
set to pts or dts.
2020-01-26 15:02:18 +00:00
@item export_all
Export unrecognized boxes within the @var{udta} box as metadata entries. The first four
characters of the box type are set as the key. Default is false.
@item export_xmp
Export entire contents of @var{XMP_} box and @var{uuid} box as a string with key @code{xmp}. Note that
if @code{export_all} is set and this option isn't, the contents of @var{XMP_} box are still exported
but with key @code{XMP_}. Default is false.
@item activation_bytes
4-byte key required to decrypt Audible AAX and AAX+ files. See Audible AAX subsection below.
@item audible_fixed_key
Fixed key used for handling Audible AAX/AAX+ files. It has been pre-set so should not be necessary to
specify.
@item decryption_key
16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
@end table
@subsection Audible AAX
Audible AAX files are encrypted M4B files, and they can be decrypted by specifying a 4 byte activation secret.
@example
ffmpeg -activation_bytes 1CEB00DA -i test.aax -vn -c:a copy output.mp4
@end example
2013-08-04 02:17:22 +00:00
@section mpegts
MPEG-2 transport stream demuxer.
2015-08-13 11:19:20 +00:00
This demuxer accepts the following options:
2013-08-04 02:17:22 +00:00
@table @option
2015-08-13 11:19:20 +00:00
@item resync_size
Set size limit for looking up a new synchronization. Default value is
65536.
2013-08-04 02:17:22 +00:00
avformat/mpegts: add skip_unknown_pmt option
Some filtered mpegts streams may erroneously include PMTs for
programs that are not advertised in the PAT. This confuses ffmpeg
and most players because multiple audio/video streams are created
and it is unclear which ones actually contain data.
See for example https://tmm1.s3.amazonaws.com/unknown-pmts.ts
In this sample, the PAT advertises exactly one program. But the
pid it points to for the program's PMT contains PMTs for other
programs as well. This is because the broadcaster decided to
re-use the same pid for multiple program PMTs.
The hardware that filtered the original multi-program stream
into a single-program stream did so by rewriting the PAT to
contain only the program that was requested. But since it just
passed through the PMT pid referenced in the PAT, multiple PMTs
are still present for the other programs.
Before:
Input #0, mpegts, from 'unknown-pmts.ts':
Duration: 00:00:10.11, start: 80741.189700, bitrate: 9655 kb/s
Program 4
Stream #0:2[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 11063 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
Stream #0:3[0x44](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:4[0x45](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
No Program
Stream #0:0[0x31]: Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv), 90k tbr, 90k tbn, 90k tbc
Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp
Stream #0:5[0x51]: Video: mpeg2video ([2][0][0][0] / 0x0002), none, 90k tbr, 90k tbn
Stream #0:6[0x54](eng): Audio: ac3 (AC-3 / 0x332D4341), 0 channels
With skip_unknown_pmt=1:
Input #0, mpegts, from 'unknown-pmts.ts':
Duration: 00:00:10.11, start: 80741.189700, bitrate: 9655 kb/s
Program 4
Stream #0:0[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 11063 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
Stream #0:1[0x44](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:2[0x45](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-08 19:49:43 +00:00
@item skip_unknown_pmt
Skip PMTs for programs not defined in the PAT. Default value is 0.
2013-08-04 02:17:22 +00:00
@item fix_teletext_pts
2015-08-13 11:27:24 +00:00
Override teletext packet PTS and DTS values with the timestamps calculated
2013-08-04 02:17:22 +00:00
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.
2015-08-13 11:19:20 +00:00
@item ts_packetsize
Output option carrying the raw packet size in bytes.
Show the detected raw packet size, cannot be set by the user.
@item scan_all_pmts
Scan and combine all PMTs. The value is an integer with value from -1
to 1 (-1 means automatic setting, 1 means enabled, 0 means
disabled). Default value is -1.
avformat/mpegts: add merge_pmt_versions option
This new optional flag makes it easier to deal with mpegts
samples where the PMT is updated and elementary streams move
to different PIDs in the middle of playback.
Previously, new AVStreams were created per PID, and it was up
to the user to figure out which streams had migrated to a new PID
(by iterating over the list of AVProgram and making guesses), and
switch seamlessly to the new AVStream during playback.
Transcoding or remuxing these streams with ffmpeg on the CLI was
also quite painful, and the user would need to extract each set
of PIDs into a separate file and then stitch them back together.
With this new option, the mpegts demuxer will automatically detect
PMT changes and feed data from the new PID to the original AVStream
that was created for the orignal PID. For mpegts samples with
stream_identifier_descriptor available, the unique ID is used to
merge PIDs together. If the stream id is not available, the demuxer
attempts to map PIDs based on their position within the PMT.
With this change, I am able to playback and transcode/remux these
two samples which previously caused issues:
https://tmm1.s3.amazonaws.com/pmt-version-change.ts
https://kuroko.fushizen.eu/videos/pid_switch_sample.ts
I also have another longer sample in which the PMT changes
repeatedly and ES streams move to different pids three times
during playback:
https://tmm1.s3.amazonaws.com/multiple-pmt-change.ts
Demuxing this sample with the new option shows several new log
messages as the PMT changes are handled:
[mpegts] detected PMT change (program=1, version=3/6, pcr_pid=0xf98/0xfb7)
[mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xfb7
[mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xfb8
[mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xfb9
[mpegts] detected PMT change (program=1, version=6/3, pcr_pid=0xfb7/0xf98)
[mpegts] detected PMT change (program=1, version=3/4, pcr_pid=0xf98/0xf9b)
[mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xf9b
[mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xf9c
[mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xf9d
[mpegts] detected PMT change (program=1, version=4/5, pcr_pid=0xf9b/0xfa9)
[mpegts] re-using existing video stream 0 (pid=0xf98) for new pid=0xfa9
[mpegts] re-using existing audio stream 1 (pid=0xf99) for new pid=0xfaa
[mpegts] re-using existing audio stream 2 (pid=0xf9a) for new pid=0xfab
[mpegts] detected PMT change (program=1, version=5/6, pcr_pid=0xfa9/0xfb7)
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-08 23:12:12 +00:00
@item merge_pmt_versions
Re-use existing streams when a PMT's version is updated and elementary
streams move to different PIDs. Default value is 0.
2013-08-04 02:17:22 +00:00
@end table
2015-11-29 23:54:14 +00:00
@section mpjpeg
MJPEG encapsulated in multi-part MIME demuxer.
This demuxer allows reading of MJPEG, where each frame is represented as a part of
multipart/x-mixed-replace stream.
@table @option
@item strict_mime_boundary
Default implementation applies a relaxed standard to multi-part MIME boundary detection,
to prevent regression with numerous existing endpoints not generating a proper MIME
MJPEG stream. Turning this option on by setting it to 1 will result in a stricter check
of the boundary value.
@end table
2013-02-08 23:58:35 +00:00
@section rawvideo
Raw video demuxer.
2014-03-06 18:07:53 +00:00
This demuxer allows one to read raw video data. Since there is no header
2013-02-08 23:58:35 +00:00
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:
@table @option
@item framerate
Set input video frame rate. Default value is 25.
@item pixel_format
Set the input video pixel format. Default value is @code{yuv420p}.
@item video_size
Set the input video size. This value must be specified explicitly.
@end table
For example to read a rawvideo file @file{input.raw} with
@command{ffplay}, assuming a pixel format of @code{rgb24}, a video
size of @code{320x240}, and a frame rate of 10 images per second, use
the command:
@example
ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
@end example
2011-11-02 15:30:27 +00:00
@section sbg
SBaGen script demuxer.
This demuxer reads the script language used by SBaGen
@url{http://uazu.net/sbagen/} to generate binaural beats sessions. A SBG
script looks like that:
@example
-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
@end example
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 @var{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.
2012-06-05 14:34:01 +00:00
@section tedcaptions
JSON captions used for @url{http://www.ted.com/, TED Talks}.
TED does not provide links to the captions, but they can be guessed from the
page. The file @file{tools/bookmarklets.html} from the FFmpeg source tree
contains a bookmarklet to expose them.
This demuxer accepts the following option:
@table @option
@item 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.
@end table
Example: convert the captions to a format most players understand:
@example
ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
@end example
2018-12-08 10:03:57 +00:00
@section vapoursynth
Vapoursynth wrapper.
Due to security concerns, Vapoursynth scripts will not
be autodetected so the input format has to be forced. For ff* CLI tools,
add @code{-f vapoursynth} before the input @code{-i yourscript.vpy}.
This demuxer accepts the following option:
@table @option
@item max_script_size
The demuxer buffers the entire script into memory. Adjust this value to set the maximum buffer size,
which in turn, acts as a ceiling for the size of scripts that can be read.
Default is 1 MiB.
@end table
2013-02-08 23:45:51 +00:00
@c man end DEMUXERS