formats.texi 9.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
@chapter Format Options
@c man begin 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 -@var{option} @var{value} in the
FFmpeg tools, or by setting the value explicitly in the
@code{AVFormatContext} options or using the @file{libavutil/opt.h} API
for programmatic use.

The list of supported options follows:

@table @option
@item avioflags @var{flags} (@emph{input/output})
Possible values:
@table @samp
@item direct
Reduce buffering.
@end table

@item probesize @var{integer} (@emph{input})
Set probing size in bytes, i.e. the size of the data to analyze to get
26
stream information. A higher value will enable detecting more
27 28 29 30 31 32
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.

@item packetsize @var{integer} (@emph{output})
Set packet size.

33 34
@item fflags @var{flags}
Set format flags. Some are implemented for a limited number of formats.
35

36
Possible values for input files:
37
@table @samp
38 39
@item discardcorrupt
Discard corrupted packets.
40 41
@item fastseek
Enable fast, but inaccurate seeks for some formats.
42
@item genpts
43 44 45 46 47 48 49 50
Generate missing PTS if DTS is present.
@item igndts
Ignore DTS if PTS is set. Inert when nofillin is set.
@item ignidx
Ignore index.
@item keepside (@emph{deprecated},@emph{inert})
@item nobuffer
Reduce the latency introduced by buffering during initial input streams analysis.
51
@item nofillin
52
Do not fill in missing values in packet fields that can be exactly calculated.
53 54 55
@item noparse
Disable AVParsers, this needs @code{+nofillin} too.
@item sortdts
56 57 58 59 60 61 62
Try to interleave output packets by DTS. At present, available only for AVIs with an index.
@end table

Possible values for output files:
@table @samp
@item autobsf
Automatically apply bitstream filters as required by the output format. Enabled by default.
63
@item bitexact
64
Only write platform-, build- and time-independent data.
65
This ensures that file and data checksums are reproducible and match between
66
platforms. Its primary use is for regression testing.
67 68 69
@item flush_packets
Write out packets immediately.
@item latm (@emph{deprecated},@emph{inert})
70 71
@item shortest
Stop muxing at the end of the shortest stream.
72
It may be needed to increase max_interleave_delta to avoid flushing the longer
73
streams before EOF.
74 75
@end table

76
@item seek2any @var{integer} (@emph{input})
77 78
Allow seeking to non-keyframes on demuxer level when supported if set to 1.
Default is 0.
79

80 81
@item analyzeduration @var{integer} (@emph{input})
Specify how many microseconds are analyzed to probe the input. A
82
higher value will enable detecting more accurate information, but will
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
increase latency. It defaults to 5,000,000 microseconds = 5 seconds.

@item cryptokey @var{hexadecimal string} (@emph{input})
Set decryption key.

@item indexmem @var{integer} (@emph{input})
Set max memory used for timestamp index (per stream).

@item rtbufsize @var{integer} (@emph{input})
Set max memory used for buffering real-time frames.

@item fdebug @var{flags} (@emph{input/output})
Print specific debug info.

Possible values:
@table @samp
@item ts
@end table

@item max_delay @var{integer} (@emph{input/output})
Set maximum muxing or demuxing delay in microseconds.

@item fpsprobesize @var{integer} (@emph{input})
Set number of frames used to probe fps.

@item audio_preload @var{integer} (@emph{output})
Set microseconds by which audio packets should be interleaved earlier.

@item chunk_duration @var{integer} (@emph{output})
Set microseconds for each chunk.

@item chunk_size @var{integer} (@emph{output})
Set size in bytes for each chunk.

@item err_detect, f_err_detect @var{flags} (@emph{input})
Set error detection flags. @code{f_err_detect} is deprecated and
should be used only via the @command{ffmpeg} tool.

Possible values:
@table @samp
@item crccheck
Verify embedded CRCs.
@item bitstream
Detect bitstream specification deviations.
@item buffer
Detect improper bitstream length.
@item explode
Abort decoding on minor error detection.
@item careful
Consider things that violate the spec and have not been seen in the
wild as errors.
@item compliant
Consider all spec non compliancies as errors.
@item aggressive
Consider things that a sane encoder should not do as an error.
@end table

140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
@item max_interleave_delta @var{integer} (@emph{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.

159
@item use_wallclock_as_timestamps @var{integer} (@emph{input})
160
Use wallclock as timestamps if set to 1. Default is 0.
161 162

@item avoid_negative_ts @var{integer} (@emph{output})
163 164 165 166 167 168 169 170 171 172 173 174 175 176

Possible values:
@table @samp
@item 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.
@item make_zero
Shift timestamps so that the first timestamp is 0.
@item auto (default)
Enables shifting when required by the target format.
@item disabled
Disables shifting of timestamp.
@end table
177 178 179 180 181 182

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.

183
@item skip_initial_bytes @var{integer} (@emph{input})
184 185
Set number of bytes to skip before reading header and frames if set to 1.
Default is 0.
186 187 188 189

@item correct_ts_overflow @var{integer} (@emph{input})
Correct single timestamp overflows if set to 1. Default is 1.

190
@item flush_packets @var{integer} (@emph{output})
191 192 193 194
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.
195 196 197 198 199 200 201 202 203 204 205 206

@item output_ts_offset @var{offset} (@emph{output})
Set the output time offset.

@var{offset} must be a time duration specification,
see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.

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 @var{offset}. Default value
is @code{0} (meaning that no offset is applied).
207 208

@item format_whitelist @var{list} (@emph{input})
209
"," separated list of allowed demuxers. By default all are allowed.
210

211 212 213 214 215 216 217 218
@item dump_separator @var{string} (@emph{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:
@example
ffprobe -dump_separator "
                          "  -i ~/videos/matrixbench_mpeg2.mpg
@end example
219 220 221 222

@item max_streams @var{integer} (@emph{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.
223 224 225 226

@item skip_estimate_duration_from_pts @var{bool} (@emph{input})
Skip estimation of input duration when calculated using PTS.
At present, applicable for MPEG-PS and MPEG-TS.
227 228 229 230
@end table

@c man end FORMAT OPTIONS

231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
@anchor{Format stream specifiers}
@section Format stream specifiers

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

Possible forms of stream specifiers are:
@table @option
@item @var{stream_index}
Matches the stream with this index.

@item @var{stream_type}[:@var{stream_index}]
@var{stream_type} is one of following: 'v' for video, 'a' for audio,
's' for subtitle, 'd' for data, and 't' for attachments. If
@var{stream_index} is given, then it matches the stream number
@var{stream_index} of this type. Otherwise, it matches all streams of
this type.

@item p:@var{program_id}[:@var{stream_index}]
If @var{stream_index} is given, then it matches the stream with number
@var{stream_index} in the program with the id
@var{program_id}. Otherwise, it matches all streams in the program.

@item #@var{stream_id}
Matches the stream by a format-specific ID.
@end table

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

262
@ifclear config-writeonly
263
@include demuxers.texi
264 265
@end ifclear
@ifclear config-readonly
266
@include muxers.texi
267
@end ifclear
268
@include metadata.texi