summaryrefslogtreecommitdiff
path: root/doc/formats.texi (plain)
blob: c51d4086db596d5f806744684285f49723581936
1@chapter Format Options
2@c man begin FORMAT OPTIONS
3
4The libavformat library provides some generic global options, which
5can be set on all the muxers and demuxers. In addition each muxer or
6demuxer may support so-called private options, which are specific for
7that component.
8
9Options may be set by specifying -@var{option} @var{value} in the
10FFmpeg tools, or by setting the value explicitly in the
11@code{AVFormatContext} options or using the @file{libavutil/opt.h} API
12for programmatic use.
13
14The list of supported options follows:
15
16@table @option
17@item avioflags @var{flags} (@emph{input/output})
18Possible values:
19@table @samp
20@item direct
21Reduce buffering.
22@end table
23
24@item probesize @var{integer} (@emph{input})
25Set probing size in bytes, i.e. the size of the data to analyze to get
26stream information. A higher value will enable detecting more
27information in case it is dispersed into the stream, but will increase
28latency. Must be an integer not lesser than 32. It is 5000000 by default.
29
30@item packetsize @var{integer} (@emph{output})
31Set packet size.
32
33@item fflags @var{flags} (@emph{input/output})
34Set format flags.
35
36Possible values:
37@table @samp
38@item ignidx
39Ignore index.
40@item fastseek
41Enable fast, but inaccurate seeks for some formats.
42@item genpts
43Generate PTS.
44@item nofillin
45Do not fill in missing values that can be exactly calculated.
46@item noparse
47Disable AVParsers, this needs @code{+nofillin} too.
48@item igndts
49Ignore DTS.
50@item discardcorrupt
51Discard corrupted frames.
52@item sortdts
53Try to interleave output packets by DTS.
54@item keepside
55Do not merge side data.
56@item latm
57Enable RTP MP4A-LATM payload.
58@item nobuffer
59Reduce the latency introduced by optional buffering
60@item bitexact
61Only write platform-, build- and time-independent data.
62This ensures that file and data checksums are reproducible and match between
63platforms. Its primary use is for regression testing.
64@item shortest
65Stop muxing at the end of the shortest stream.
66It may be needed to increase max_interleave_delta to avoid flushing the longer
67streams before EOF.
68@end table
69
70@item seek2any @var{integer} (@emph{input})
71Allow seeking to non-keyframes on demuxer level when supported if set to 1.
72Default is 0.
73
74@item analyzeduration @var{integer} (@emph{input})
75Specify how many microseconds are analyzed to probe the input. A
76higher value will enable detecting more accurate information, but will
77increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
78
79@item cryptokey @var{hexadecimal string} (@emph{input})
80Set decryption key.
81
82@item indexmem @var{integer} (@emph{input})
83Set max memory used for timestamp index (per stream).
84
85@item rtbufsize @var{integer} (@emph{input})
86Set max memory used for buffering real-time frames.
87
88@item fdebug @var{flags} (@emph{input/output})
89Print specific debug info.
90
91Possible values:
92@table @samp
93@item ts
94@end table
95
96@item max_delay @var{integer} (@emph{input/output})
97Set maximum muxing or demuxing delay in microseconds.
98
99@item fpsprobesize @var{integer} (@emph{input})
100Set number of frames used to probe fps.
101
102@item audio_preload @var{integer} (@emph{output})
103Set microseconds by which audio packets should be interleaved earlier.
104
105@item chunk_duration @var{integer} (@emph{output})
106Set microseconds for each chunk.
107
108@item chunk_size @var{integer} (@emph{output})
109Set size in bytes for each chunk.
110
111@item err_detect, f_err_detect @var{flags} (@emph{input})
112Set error detection flags. @code{f_err_detect} is deprecated and
113should be used only via the @command{ffmpeg} tool.
114
115Possible values:
116@table @samp
117@item crccheck
118Verify embedded CRCs.
119@item bitstream
120Detect bitstream specification deviations.
121@item buffer
122Detect improper bitstream length.
123@item explode
124Abort decoding on minor error detection.
125@item careful
126Consider things that violate the spec and have not been seen in the
127wild as errors.
128@item compliant
129Consider all spec non compliancies as errors.
130@item aggressive
131Consider things that a sane encoder should not do as an error.
132@end table
133
134@item max_interleave_delta @var{integer} (@emph{output})
135Set maximum buffering duration for interleaving. The duration is
136expressed in microseconds, and defaults to 1000000 (1 second).
137
138To ensure all the streams are interleaved correctly, libavformat will
139wait until it has at least one packet for each stream before actually
140writing any packets to the output file. When some streams are
141"sparse" (i.e. there are large gaps between successive packets), this
142can result in excessive buffering.
143
144This field specifies the maximum difference between the timestamps of the
145first and the last packet in the muxing queue, above which libavformat
146will output a packet regardless of whether it has queued a packet for all
147the streams.
148
149If set to 0, libavformat will continue buffering packets until it has
150a packet for each stream, regardless of the maximum timestamp
151difference between the buffered packets.
152
153@item use_wallclock_as_timestamps @var{integer} (@emph{input})
154Use wallclock as timestamps if set to 1. Default is 0.
155
156@item avoid_negative_ts @var{integer} (@emph{output})
157
158Possible values:
159@table @samp
160@item make_non_negative
161Shift timestamps to make them non-negative.
162Also note that this affects only leading negative timestamps, and not
163non-monotonic negative timestamps.
164@item make_zero
165Shift timestamps so that the first timestamp is 0.
166@item auto (default)
167Enables shifting when required by the target format.
168@item disabled
169Disables shifting of timestamp.
170@end table
171
172When shifting is enabled, all output timestamps are shifted by the
173same amount. Audio, video, and subtitles desynching and relative
174timestamp differences are preserved compared to how they would have
175been without shifting.
176
177@item skip_initial_bytes @var{integer} (@emph{input})
178Set number of bytes to skip before reading header and frames if set to 1.
179Default is 0.
180
181@item correct_ts_overflow @var{integer} (@emph{input})
182Correct single timestamp overflows if set to 1. Default is 1.
183
184@item flush_packets @var{integer} (@emph{output})
185Flush the underlying I/O stream after each packet. Default 1 enables it, and
186has the effect of reducing the latency; 0 disables it and may slightly
187increase performance in some cases.
188
189@item output_ts_offset @var{offset} (@emph{output})
190Set the output time offset.
191
192@var{offset} must be a time duration specification,
193see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
194
195The offset is added by the muxer to the output timestamps.
196
197Specifying a positive offset means that the corresponding streams are
198delayed bt the time duration specified in @var{offset}. Default value
199is @code{0} (meaning that no offset is applied).
200
201@item format_whitelist @var{list} (@emph{input})
202"," separated list of allowed demuxers. By default all are allowed.
203
204@item dump_separator @var{string} (@emph{input})
205Separator used to separate the fields printed on the command line about the
206Stream parameters.
207For example to separate the fields with newlines and indention:
208@example
209ffprobe -dump_separator "
210 " -i ~/videos/matrixbench_mpeg2.mpg
211@end example
212
213@item max_streams @var{integer} (@emph{input})
214Specifies the maximum number of streams. This can be used to reject files that
215would require too many resources due to a large number of streams.
216@end table
217
218@c man end FORMAT OPTIONS
219
220@anchor{Format stream specifiers}
221@section Format stream specifiers
222
223Format stream specifiers allow selection of one or more streams that
224match specific properties.
225
226Possible forms of stream specifiers are:
227@table @option
228@item @var{stream_index}
229Matches the stream with this index.
230
231@item @var{stream_type}[:@var{stream_index}]
232@var{stream_type} is one of following: 'v' for video, 'a' for audio,
233's' for subtitle, 'd' for data, and 't' for attachments. If
234@var{stream_index} is given, then it matches the stream number
235@var{stream_index} of this type. Otherwise, it matches all streams of
236this type.
237
238@item p:@var{program_id}[:@var{stream_index}]
239If @var{stream_index} is given, then it matches the stream with number
240@var{stream_index} in the program with the id
241@var{program_id}. Otherwise, it matches all streams in the program.
242
243@item #@var{stream_id}
244Matches the stream by a format-specific ID.
245@end table
246
247The exact semantics of stream specifiers is defined by the
248@code{avformat_match_stream_specifier()} function declared in the
249@file{libavformat/avformat.h} header.
250
251@ifclear config-writeonly
252@include demuxers.texi
253@end ifclear
254@ifclear config-readonly
255@include muxers.texi
256@end ifclear
257@include metadata.texi
258