yading@10
|
1 =head1 NAME
|
yading@10
|
2
|
yading@10
|
3 ffmpeg-formats - FFmpeg formats
|
yading@10
|
4
|
yading@10
|
5 =head1 DESCRIPTION
|
yading@10
|
6
|
yading@10
|
7
|
yading@10
|
8 This document describes the supported formats (muxers and demuxers)
|
yading@10
|
9 provided by the libavformat library.
|
yading@10
|
10
|
yading@10
|
11
|
yading@10
|
12
|
yading@10
|
13 =head1 FORMAT OPTIONS
|
yading@10
|
14
|
yading@10
|
15
|
yading@10
|
16 The libavformat library provides some generic global options, which
|
yading@10
|
17 can be set on all the muxers and demuxers. In addition each muxer or
|
yading@10
|
18 demuxer may support so-called private options, which are specific for
|
yading@10
|
19 that component.
|
yading@10
|
20
|
yading@10
|
21 Options may be set by specifying -I<option> I<value> in the
|
yading@10
|
22 FFmpeg tools, or by setting the value explicitly in the
|
yading@10
|
23 C<AVFormatContext> options or using the F<libavutil/opt.h> API
|
yading@10
|
24 for programmatic use.
|
yading@10
|
25
|
yading@10
|
26 The list of supported options follows:
|
yading@10
|
27
|
yading@10
|
28
|
yading@10
|
29 =over 4
|
yading@10
|
30
|
yading@10
|
31
|
yading@10
|
32 =item B<avioflags> I<flags> B<(>I<input/output>B<)>
|
yading@10
|
33
|
yading@10
|
34 Possible values:
|
yading@10
|
35
|
yading@10
|
36 =over 4
|
yading@10
|
37
|
yading@10
|
38
|
yading@10
|
39 =item B<direct>
|
yading@10
|
40
|
yading@10
|
41 Reduce buffering.
|
yading@10
|
42
|
yading@10
|
43 =back
|
yading@10
|
44
|
yading@10
|
45
|
yading@10
|
46
|
yading@10
|
47 =item B<probesize> I<integer> B<(>I<input>B<)>
|
yading@10
|
48
|
yading@10
|
49 Set probing size in bytes, i.e. the size of the data to analyze to get
|
yading@10
|
50 stream information. A higher value will allow to detect more
|
yading@10
|
51 information in case it is dispersed into the stream, but will increase
|
yading@10
|
52 latency. Must be an integer not lesser than 32. It is 5000000 by default.
|
yading@10
|
53
|
yading@10
|
54
|
yading@10
|
55 =item B<packetsize> I<integer> B<(>I<output>B<)>
|
yading@10
|
56
|
yading@10
|
57 Set packet size.
|
yading@10
|
58
|
yading@10
|
59
|
yading@10
|
60 =item B<fflags> I<flags> B<(>I<input/output>B<)>
|
yading@10
|
61
|
yading@10
|
62 Set format flags.
|
yading@10
|
63
|
yading@10
|
64 Possible values:
|
yading@10
|
65
|
yading@10
|
66 =over 4
|
yading@10
|
67
|
yading@10
|
68
|
yading@10
|
69 =item B<ignidx>
|
yading@10
|
70
|
yading@10
|
71 Ignore index.
|
yading@10
|
72
|
yading@10
|
73 =item B<genpts>
|
yading@10
|
74
|
yading@10
|
75 Generate PTS.
|
yading@10
|
76
|
yading@10
|
77 =item B<nofillin>
|
yading@10
|
78
|
yading@10
|
79 Do not fill in missing values that can be exactly calculated.
|
yading@10
|
80
|
yading@10
|
81 =item B<noparse>
|
yading@10
|
82
|
yading@10
|
83 Disable AVParsers, this needs C<+nofillin> too.
|
yading@10
|
84
|
yading@10
|
85 =item B<igndts>
|
yading@10
|
86
|
yading@10
|
87 Ignore DTS.
|
yading@10
|
88
|
yading@10
|
89 =item B<discardcorrupt>
|
yading@10
|
90
|
yading@10
|
91 Discard corrupted frames.
|
yading@10
|
92
|
yading@10
|
93 =item B<sortdts>
|
yading@10
|
94
|
yading@10
|
95 Try to interleave output packets by DTS.
|
yading@10
|
96
|
yading@10
|
97 =item B<keepside>
|
yading@10
|
98
|
yading@10
|
99 Do not merge side data.
|
yading@10
|
100
|
yading@10
|
101 =item B<latm>
|
yading@10
|
102
|
yading@10
|
103 Enable RTP MP4A-LATM payload.
|
yading@10
|
104
|
yading@10
|
105 =item B<nobuffer>
|
yading@10
|
106
|
yading@10
|
107 Reduce the latency introduced by optional buffering
|
yading@10
|
108
|
yading@10
|
109 =back
|
yading@10
|
110
|
yading@10
|
111
|
yading@10
|
112
|
yading@10
|
113 =item B<analyzeduration> I<integer> B<(>I<input>B<)>
|
yading@10
|
114
|
yading@10
|
115 Specify how many microseconds are analyzed to probe the input. A
|
yading@10
|
116 higher value will allow to detect more accurate information, but will
|
yading@10
|
117 increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
|
yading@10
|
118
|
yading@10
|
119
|
yading@10
|
120 =item B<cryptokey> I<hexadecimal string> B<(>I<input>B<)>
|
yading@10
|
121
|
yading@10
|
122 Set decryption key.
|
yading@10
|
123
|
yading@10
|
124
|
yading@10
|
125 =item B<indexmem> I<integer> B<(>I<input>B<)>
|
yading@10
|
126
|
yading@10
|
127 Set max memory used for timestamp index (per stream).
|
yading@10
|
128
|
yading@10
|
129
|
yading@10
|
130 =item B<rtbufsize> I<integer> B<(>I<input>B<)>
|
yading@10
|
131
|
yading@10
|
132 Set max memory used for buffering real-time frames.
|
yading@10
|
133
|
yading@10
|
134
|
yading@10
|
135 =item B<fdebug> I<flags> B<(>I<input/output>B<)>
|
yading@10
|
136
|
yading@10
|
137 Print specific debug info.
|
yading@10
|
138
|
yading@10
|
139 Possible values:
|
yading@10
|
140
|
yading@10
|
141 =over 4
|
yading@10
|
142
|
yading@10
|
143
|
yading@10
|
144 =item B<ts>
|
yading@10
|
145
|
yading@10
|
146
|
yading@10
|
147 =back
|
yading@10
|
148
|
yading@10
|
149
|
yading@10
|
150
|
yading@10
|
151 =item B<max_delay> I<integer> B<(>I<input/output>B<)>
|
yading@10
|
152
|
yading@10
|
153 Set maximum muxing or demuxing delay in microseconds.
|
yading@10
|
154
|
yading@10
|
155
|
yading@10
|
156 =item B<fpsprobesize> I<integer> B<(>I<input>B<)>
|
yading@10
|
157
|
yading@10
|
158 Set number of frames used to probe fps.
|
yading@10
|
159
|
yading@10
|
160
|
yading@10
|
161 =item B<audio_preload> I<integer> B<(>I<output>B<)>
|
yading@10
|
162
|
yading@10
|
163 Set microseconds by which audio packets should be interleaved earlier.
|
yading@10
|
164
|
yading@10
|
165
|
yading@10
|
166 =item B<chunk_duration> I<integer> B<(>I<output>B<)>
|
yading@10
|
167
|
yading@10
|
168 Set microseconds for each chunk.
|
yading@10
|
169
|
yading@10
|
170
|
yading@10
|
171 =item B<chunk_size> I<integer> B<(>I<output>B<)>
|
yading@10
|
172
|
yading@10
|
173 Set size in bytes for each chunk.
|
yading@10
|
174
|
yading@10
|
175
|
yading@10
|
176 =item B<err_detect, f_err_detect> I<flags> B<(>I<input>B<)>
|
yading@10
|
177
|
yading@10
|
178 Set error detection flags. C<f_err_detect> is deprecated and
|
yading@10
|
179 should be used only via the B<ffmpeg> tool.
|
yading@10
|
180
|
yading@10
|
181 Possible values:
|
yading@10
|
182
|
yading@10
|
183 =over 4
|
yading@10
|
184
|
yading@10
|
185
|
yading@10
|
186 =item B<crccheck>
|
yading@10
|
187
|
yading@10
|
188 Verify embedded CRCs.
|
yading@10
|
189
|
yading@10
|
190 =item B<bitstream>
|
yading@10
|
191
|
yading@10
|
192 Detect bitstream specification deviations.
|
yading@10
|
193
|
yading@10
|
194 =item B<buffer>
|
yading@10
|
195
|
yading@10
|
196 Detect improper bitstream length.
|
yading@10
|
197
|
yading@10
|
198 =item B<explode>
|
yading@10
|
199
|
yading@10
|
200 Abort decoding on minor error detection.
|
yading@10
|
201
|
yading@10
|
202 =item B<careful>
|
yading@10
|
203
|
yading@10
|
204 Consider things that violate the spec and have not been seen in the
|
yading@10
|
205 wild as errors.
|
yading@10
|
206
|
yading@10
|
207 =item B<compliant>
|
yading@10
|
208
|
yading@10
|
209 Consider all spec non compliancies as errors.
|
yading@10
|
210
|
yading@10
|
211 =item B<aggressive>
|
yading@10
|
212
|
yading@10
|
213 Consider things that a sane encoder should not do as an error.
|
yading@10
|
214
|
yading@10
|
215 =back
|
yading@10
|
216
|
yading@10
|
217
|
yading@10
|
218
|
yading@10
|
219 =item B<use_wallclock_as_timestamps> I<integer> B<(>I<input>B<)>
|
yading@10
|
220
|
yading@10
|
221 Use wallclock as timestamps.
|
yading@10
|
222
|
yading@10
|
223
|
yading@10
|
224 =item B<avoid_negative_ts> I<integer> B<(>I<output>B<)>
|
yading@10
|
225
|
yading@10
|
226 Shift timestamps to make them positive. A value of 1 enables shifting,
|
yading@10
|
227 a value of 0 disables it, the default value of -1 enables shifting
|
yading@10
|
228 when required by the target format.
|
yading@10
|
229
|
yading@10
|
230 When shifting is enabled, all output timestamps are shifted by the
|
yading@10
|
231 same amount. Audio, video, and subtitles desynching and relative
|
yading@10
|
232 timestamp differences are preserved compared to how they would have
|
yading@10
|
233 been without shifting.
|
yading@10
|
234
|
yading@10
|
235 Also note that this affects only leading negative timestamps, and not
|
yading@10
|
236 non-monotonic negative timestamps.
|
yading@10
|
237
|
yading@10
|
238
|
yading@10
|
239 =item B<flush_packets> I<integer> B<(>I<output>B<)>
|
yading@10
|
240
|
yading@10
|
241 Flush the underlying I/O stream after each packet. Default 1 enables it, and
|
yading@10
|
242 has the effect of reducing the latency; 0 disables it and may slightly
|
yading@10
|
243 increase performance in some cases.
|
yading@10
|
244
|
yading@10
|
245 =back
|
yading@10
|
246
|
yading@10
|
247
|
yading@10
|
248
|
yading@10
|
249
|
yading@10
|
250 =head1 DEMUXERS
|
yading@10
|
251
|
yading@10
|
252
|
yading@10
|
253 Demuxers are configured elements in FFmpeg which allow to read the
|
yading@10
|
254 multimedia streams from a particular type of file.
|
yading@10
|
255
|
yading@10
|
256 When you configure your FFmpeg build, all the supported demuxers
|
yading@10
|
257 are enabled by default. You can list all available ones using the
|
yading@10
|
258 configure option C<--list-demuxers>.
|
yading@10
|
259
|
yading@10
|
260 You can disable all the demuxers using the configure option
|
yading@10
|
261 C<--disable-demuxers>, and selectively enable a single demuxer with
|
yading@10
|
262 the option C<--enable-demuxer=I<DEMUXER>>, or disable it
|
yading@10
|
263 with the option C<--disable-demuxer=I<DEMUXER>>.
|
yading@10
|
264
|
yading@10
|
265 The option C<-formats> of the ff* tools will display the list of
|
yading@10
|
266 enabled demuxers.
|
yading@10
|
267
|
yading@10
|
268 The description of some of the currently available demuxers follows.
|
yading@10
|
269
|
yading@10
|
270
|
yading@10
|
271 =head2 applehttp
|
yading@10
|
272
|
yading@10
|
273
|
yading@10
|
274 Apple HTTP Live Streaming demuxer.
|
yading@10
|
275
|
yading@10
|
276 This demuxer presents all AVStreams from all variant streams.
|
yading@10
|
277 The id field is set to the bitrate variant index number. By setting
|
yading@10
|
278 the discard flags on AVStreams (by pressing 'a' or 'v' in ffplay),
|
yading@10
|
279 the caller can decide which variant streams to actually receive.
|
yading@10
|
280 The total bitrate of the variant that the stream belongs to is
|
yading@10
|
281 available in a metadata key named "variant_bitrate".
|
yading@10
|
282
|
yading@10
|
283
|
yading@10
|
284
|
yading@10
|
285 =head2 concat
|
yading@10
|
286
|
yading@10
|
287
|
yading@10
|
288 Virtual concatenation script demuxer.
|
yading@10
|
289
|
yading@10
|
290 This demuxer reads a list of files and other directives from a text file and
|
yading@10
|
291 demuxes them one after the other, as if all their packet had been muxed
|
yading@10
|
292 together.
|
yading@10
|
293
|
yading@10
|
294 The timestamps in the files are adjusted so that the first file starts at 0
|
yading@10
|
295 and each next file starts where the previous one finishes. Note that it is
|
yading@10
|
296 done globally and may cause gaps if all streams do not have exactly the same
|
yading@10
|
297 length.
|
yading@10
|
298
|
yading@10
|
299 All files must have the same streams (same codecs, same time base, etc.).
|
yading@10
|
300
|
yading@10
|
301 The duration of each file is used to adjust the timestamps of the next file:
|
yading@10
|
302 if the duration is incorrect (because it was computed using the bit-rate or
|
yading@10
|
303 because the file is truncated, for example), it can cause artifacts. The
|
yading@10
|
304 C<duration> directive can be used to override the duration stored in
|
yading@10
|
305 each file.
|
yading@10
|
306
|
yading@10
|
307
|
yading@10
|
308 =head3 Syntax
|
yading@10
|
309
|
yading@10
|
310
|
yading@10
|
311 The script is a text file in extended-ASCII, with one directive per line.
|
yading@10
|
312 Empty lines, leading spaces and lines starting with '#' are ignored. The
|
yading@10
|
313 following directive is recognized:
|
yading@10
|
314
|
yading@10
|
315
|
yading@10
|
316 =over 4
|
yading@10
|
317
|
yading@10
|
318
|
yading@10
|
319
|
yading@10
|
320 =item B<C<file I<path>>>
|
yading@10
|
321
|
yading@10
|
322 Path to a file to read; special characters and spaces must be escaped with
|
yading@10
|
323 backslash or single quotes.
|
yading@10
|
324
|
yading@10
|
325 All subsequent directives apply to that file.
|
yading@10
|
326
|
yading@10
|
327
|
yading@10
|
328 =item B<C<ffconcat version 1.0>>
|
yading@10
|
329
|
yading@10
|
330 Identify the script type and version. It also sets the B<safe> option
|
yading@10
|
331 to 1 if it was to its default -1.
|
yading@10
|
332
|
yading@10
|
333 To make FFmpeg recognize the format automatically, this directive must
|
yading@10
|
334 appears exactly as is (no extra space or byte-order-mark) on the very first
|
yading@10
|
335 line of the script.
|
yading@10
|
336
|
yading@10
|
337
|
yading@10
|
338 =item B<C<duration I<dur>>>
|
yading@10
|
339
|
yading@10
|
340 Duration of the file. This information can be specified from the file;
|
yading@10
|
341 specifying it here may be more efficient or help if the information from the
|
yading@10
|
342 file is not available or accurate.
|
yading@10
|
343
|
yading@10
|
344 If the duration is set for all files, then it is possible to seek in the
|
yading@10
|
345 whole concatenated video.
|
yading@10
|
346
|
yading@10
|
347
|
yading@10
|
348 =back
|
yading@10
|
349
|
yading@10
|
350
|
yading@10
|
351
|
yading@10
|
352 =head3 Options
|
yading@10
|
353
|
yading@10
|
354
|
yading@10
|
355 This demuxer accepts the following option:
|
yading@10
|
356
|
yading@10
|
357
|
yading@10
|
358 =over 4
|
yading@10
|
359
|
yading@10
|
360
|
yading@10
|
361
|
yading@10
|
362 =item B<safe>
|
yading@10
|
363
|
yading@10
|
364 If set to 1, reject unsafe file paths. A file path is considered safe if it
|
yading@10
|
365 does not contain a protocol specification and is relative and all components
|
yading@10
|
366 only contain characters from the portable character set (letters, digits,
|
yading@10
|
367 period, underscore and hyphen) and have no period at the beginning of a
|
yading@10
|
368 component.
|
yading@10
|
369
|
yading@10
|
370 If set to 0, any file name is accepted.
|
yading@10
|
371
|
yading@10
|
372 The default is -1, it is equivalent to 1 if the format was automatically
|
yading@10
|
373 probed and 0 otherwise.
|
yading@10
|
374
|
yading@10
|
375
|
yading@10
|
376 =back
|
yading@10
|
377
|
yading@10
|
378
|
yading@10
|
379
|
yading@10
|
380 =head2 libquvi
|
yading@10
|
381
|
yading@10
|
382
|
yading@10
|
383 Play media from Internet services using the quvi project.
|
yading@10
|
384
|
yading@10
|
385 The demuxer accepts a B<format> option to request a specific quality. It
|
yading@10
|
386 is by default set to I<best>.
|
yading@10
|
387
|
yading@10
|
388 See E<lt>B<http://quvi.sourceforge.net/>E<gt> for more information.
|
yading@10
|
389
|
yading@10
|
390 FFmpeg needs to be built with C<--enable-libquvi> for this demuxer to be
|
yading@10
|
391 enabled.
|
yading@10
|
392
|
yading@10
|
393
|
yading@10
|
394 =head2 image2
|
yading@10
|
395
|
yading@10
|
396
|
yading@10
|
397 Image file demuxer.
|
yading@10
|
398
|
yading@10
|
399 This demuxer reads from a list of image files specified by a pattern.
|
yading@10
|
400 The syntax and meaning of the pattern is specified by the
|
yading@10
|
401 option I<pattern_type>.
|
yading@10
|
402
|
yading@10
|
403 The pattern may contain a suffix which is used to automatically
|
yading@10
|
404 determine the format of the images contained in the files.
|
yading@10
|
405
|
yading@10
|
406 The size, the pixel format, and the format of each image must be the
|
yading@10
|
407 same for all the files in the sequence.
|
yading@10
|
408
|
yading@10
|
409 This demuxer accepts the following options:
|
yading@10
|
410
|
yading@10
|
411 =over 4
|
yading@10
|
412
|
yading@10
|
413
|
yading@10
|
414 =item B<framerate>
|
yading@10
|
415
|
yading@10
|
416 Set the frame rate for the video stream. It defaults to 25.
|
yading@10
|
417
|
yading@10
|
418 =item B<loop>
|
yading@10
|
419
|
yading@10
|
420 If set to 1, loop over the input. Default value is 0.
|
yading@10
|
421
|
yading@10
|
422 =item B<pattern_type>
|
yading@10
|
423
|
yading@10
|
424 Select the pattern type used to interpret the provided filename.
|
yading@10
|
425
|
yading@10
|
426 I<pattern_type> accepts one of the following values.
|
yading@10
|
427
|
yading@10
|
428 =over 4
|
yading@10
|
429
|
yading@10
|
430
|
yading@10
|
431 =item B<sequence>
|
yading@10
|
432
|
yading@10
|
433 Select a sequence pattern type, used to specify a sequence of files
|
yading@10
|
434 indexed by sequential numbers.
|
yading@10
|
435
|
yading@10
|
436 A sequence pattern may contain the string "%d" or "%0I<N>d", which
|
yading@10
|
437 specifies the position of the characters representing a sequential
|
yading@10
|
438 number in each filename matched by the pattern. If the form
|
yading@10
|
439 "%d0I<N>d" is used, the string representing the number in each
|
yading@10
|
440 filename is 0-padded and I<N> is the total number of 0-padded
|
yading@10
|
441 digits representing the number. The literal character '%' can be
|
yading@10
|
442 specified in the pattern with the string "%%".
|
yading@10
|
443
|
yading@10
|
444 If the sequence pattern contains "%d" or "%0I<N>d", the first filename of
|
yading@10
|
445 the file list specified by the pattern must contain a number
|
yading@10
|
446 inclusively contained between I<start_number> and
|
yading@10
|
447 I<start_number>+I<start_number_range>-1, and all the following
|
yading@10
|
448 numbers must be sequential.
|
yading@10
|
449
|
yading@10
|
450 For example the pattern "img-%03d.bmp" will match a sequence of
|
yading@10
|
451 filenames of the form F<img-001.bmp>, F<img-002.bmp>, ...,
|
yading@10
|
452 F<img-010.bmp>, etc.; the pattern "i%%m%%g-%d.jpg" will match a
|
yading@10
|
453 sequence of filenames of the form F<i%m%g-1.jpg>,
|
yading@10
|
454 F<i%m%g-2.jpg>, ..., F<i%m%g-10.jpg>, etc.
|
yading@10
|
455
|
yading@10
|
456 Note that the pattern must not necessarily contain "%d" or
|
yading@10
|
457 "%0I<N>d", for example to convert a single image file
|
yading@10
|
458 F<img.jpeg> you can employ the command:
|
yading@10
|
459
|
yading@10
|
460 ffmpeg -i img.jpeg img.png
|
yading@10
|
461
|
yading@10
|
462
|
yading@10
|
463
|
yading@10
|
464 =item B<glob>
|
yading@10
|
465
|
yading@10
|
466 Select a glob wildcard pattern type.
|
yading@10
|
467
|
yading@10
|
468 The pattern is interpreted like a C<glob()> pattern. This is only
|
yading@10
|
469 selectable if libavformat was compiled with globbing support.
|
yading@10
|
470
|
yading@10
|
471
|
yading@10
|
472 =item B<glob_sequence> I<(deprecated, will be removed)>
|
yading@10
|
473
|
yading@10
|
474 Select a mixed glob wildcard/sequence pattern.
|
yading@10
|
475
|
yading@10
|
476 If your version of libavformat was compiled with globbing support, and
|
yading@10
|
477 the provided pattern contains at least one glob meta character among
|
yading@10
|
478 C<%*?[]{}> that is preceded by an unescaped "%", the pattern is
|
yading@10
|
479 interpreted like a C<glob()> pattern, otherwise it is interpreted
|
yading@10
|
480 like a sequence pattern.
|
yading@10
|
481
|
yading@10
|
482 All glob special characters C<%*?[]{}> must be prefixed
|
yading@10
|
483 with "%". To escape a literal "%" you shall use "%%".
|
yading@10
|
484
|
yading@10
|
485 For example the pattern C<foo-%*.jpeg> will match all the
|
yading@10
|
486 filenames prefixed by "foo-" and terminating with ".jpeg", and
|
yading@10
|
487 C<foo-%?%?%?.jpeg> will match all the filenames prefixed with
|
yading@10
|
488 "foo-", followed by a sequence of three characters, and terminating
|
yading@10
|
489 with ".jpeg".
|
yading@10
|
490
|
yading@10
|
491 This pattern type is deprecated in favor of I<glob> and
|
yading@10
|
492 I<sequence>.
|
yading@10
|
493
|
yading@10
|
494 =back
|
yading@10
|
495
|
yading@10
|
496
|
yading@10
|
497 Default value is I<glob_sequence>.
|
yading@10
|
498
|
yading@10
|
499 =item B<pixel_format>
|
yading@10
|
500
|
yading@10
|
501 Set the pixel format of the images to read. If not specified the pixel
|
yading@10
|
502 format is guessed from the first image file in the sequence.
|
yading@10
|
503
|
yading@10
|
504 =item B<start_number>
|
yading@10
|
505
|
yading@10
|
506 Set the index of the file matched by the image file pattern to start
|
yading@10
|
507 to read from. Default value is 0.
|
yading@10
|
508
|
yading@10
|
509 =item B<start_number_range>
|
yading@10
|
510
|
yading@10
|
511 Set the index interval range to check when looking for the first image
|
yading@10
|
512 file in the sequence, starting from I<start_number>. Default value
|
yading@10
|
513 is 5.
|
yading@10
|
514
|
yading@10
|
515 =item B<video_size>
|
yading@10
|
516
|
yading@10
|
517 Set the video size of the images to read. If not specified the video
|
yading@10
|
518 size is guessed from the first image file in the sequence.
|
yading@10
|
519
|
yading@10
|
520 =back
|
yading@10
|
521
|
yading@10
|
522
|
yading@10
|
523
|
yading@10
|
524 =head3 Examples
|
yading@10
|
525
|
yading@10
|
526
|
yading@10
|
527
|
yading@10
|
528 =over 4
|
yading@10
|
529
|
yading@10
|
530
|
yading@10
|
531 =item *
|
yading@10
|
532
|
yading@10
|
533 Use B<ffmpeg> for creating a video from the images in the file
|
yading@10
|
534 sequence F<img-001.jpeg>, F<img-002.jpeg>, ..., assuming an
|
yading@10
|
535 input frame rate of 10 frames per second:
|
yading@10
|
536
|
yading@10
|
537 ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv
|
yading@10
|
538
|
yading@10
|
539
|
yading@10
|
540
|
yading@10
|
541 =item *
|
yading@10
|
542
|
yading@10
|
543 As above, but start by reading from a file with index 100 in the sequence:
|
yading@10
|
544
|
yading@10
|
545 ffmpeg -start_number 100 -i 'img-%03d.jpeg' -r 10 out.mkv
|
yading@10
|
546
|
yading@10
|
547
|
yading@10
|
548
|
yading@10
|
549 =item *
|
yading@10
|
550
|
yading@10
|
551 Read images matching the "*.png" glob pattern , that is all the files
|
yading@10
|
552 terminating with the ".png" suffix:
|
yading@10
|
553
|
yading@10
|
554 ffmpeg -pattern_type glob -i "*.png" -r 10 out.mkv
|
yading@10
|
555
|
yading@10
|
556
|
yading@10
|
557 =back
|
yading@10
|
558
|
yading@10
|
559
|
yading@10
|
560
|
yading@10
|
561 =head2 rawvideo
|
yading@10
|
562
|
yading@10
|
563
|
yading@10
|
564 Raw video demuxer.
|
yading@10
|
565
|
yading@10
|
566 This demuxer allows to read raw video data. Since there is no header
|
yading@10
|
567 specifying the assumed video parameters, the user must specify them
|
yading@10
|
568 in order to be able to decode the data correctly.
|
yading@10
|
569
|
yading@10
|
570 This demuxer accepts the following options:
|
yading@10
|
571
|
yading@10
|
572 =over 4
|
yading@10
|
573
|
yading@10
|
574
|
yading@10
|
575
|
yading@10
|
576 =item B<framerate>
|
yading@10
|
577
|
yading@10
|
578 Set input video frame rate. Default value is 25.
|
yading@10
|
579
|
yading@10
|
580
|
yading@10
|
581 =item B<pixel_format>
|
yading@10
|
582
|
yading@10
|
583 Set the input video pixel format. Default value is C<yuv420p>.
|
yading@10
|
584
|
yading@10
|
585
|
yading@10
|
586 =item B<video_size>
|
yading@10
|
587
|
yading@10
|
588 Set the input video size. This value must be specified explicitly.
|
yading@10
|
589
|
yading@10
|
590 =back
|
yading@10
|
591
|
yading@10
|
592
|
yading@10
|
593 For example to read a rawvideo file F<input.raw> with
|
yading@10
|
594 B<ffplay>, assuming a pixel format of C<rgb24>, a video
|
yading@10
|
595 size of C<320x240>, and a frame rate of 10 images per second, use
|
yading@10
|
596 the command:
|
yading@10
|
597
|
yading@10
|
598 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
|
yading@10
|
599
|
yading@10
|
600
|
yading@10
|
601
|
yading@10
|
602 =head2 sbg
|
yading@10
|
603
|
yading@10
|
604
|
yading@10
|
605 SBaGen script demuxer.
|
yading@10
|
606
|
yading@10
|
607 This demuxer reads the script language used by SBaGen
|
yading@10
|
608 E<lt>B<http://uazu.net/sbagen/>E<gt> to generate binaural beats sessions. A SBG
|
yading@10
|
609 script looks like that:
|
yading@10
|
610
|
yading@10
|
611 -SE
|
yading@10
|
612 a: 300-2.5/3 440+4.5/0
|
yading@10
|
613 b: 300-2.5/0 440+4.5/3
|
yading@10
|
614 off: -
|
yading@10
|
615 NOW == a
|
yading@10
|
616 +0:07:00 == b
|
yading@10
|
617 +0:14:00 == a
|
yading@10
|
618 +0:21:00 == b
|
yading@10
|
619 +0:30:00 off
|
yading@10
|
620
|
yading@10
|
621
|
yading@10
|
622 A SBG script can mix absolute and relative timestamps. If the script uses
|
yading@10
|
623 either only absolute timestamps (including the script start time) or only
|
yading@10
|
624 relative ones, then its layout is fixed, and the conversion is
|
yading@10
|
625 straightforward. On the other hand, if the script mixes both kind of
|
yading@10
|
626 timestamps, then the I<NOW> reference for relative timestamps will be
|
yading@10
|
627 taken from the current time of day at the time the script is read, and the
|
yading@10
|
628 script layout will be frozen according to that reference. That means that if
|
yading@10
|
629 the script is directly played, the actual times will match the absolute
|
yading@10
|
630 timestamps up to the sound controller's clock accuracy, but if the user
|
yading@10
|
631 somehow pauses the playback or seeks, all times will be shifted accordingly.
|
yading@10
|
632
|
yading@10
|
633
|
yading@10
|
634 =head2 tedcaptions
|
yading@10
|
635
|
yading@10
|
636
|
yading@10
|
637 JSON captions used for E<lt>B<http://www.ted.com/>E<gt>.
|
yading@10
|
638
|
yading@10
|
639 TED does not provide links to the captions, but they can be guessed from the
|
yading@10
|
640 page. The file F<tools/bookmarklets.html> from the FFmpeg source tree
|
yading@10
|
641 contains a bookmarklet to expose them.
|
yading@10
|
642
|
yading@10
|
643 This demuxer accepts the following option:
|
yading@10
|
644
|
yading@10
|
645 =over 4
|
yading@10
|
646
|
yading@10
|
647
|
yading@10
|
648 =item B<start_time>
|
yading@10
|
649
|
yading@10
|
650 Set the start time of the TED talk, in milliseconds. The default is 15000
|
yading@10
|
651 (15s). It is used to sync the captions with the downloadable videos, because
|
yading@10
|
652 they include a 15s intro.
|
yading@10
|
653
|
yading@10
|
654 =back
|
yading@10
|
655
|
yading@10
|
656
|
yading@10
|
657 Example: convert the captions to a format most players understand:
|
yading@10
|
658
|
yading@10
|
659 ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
|
yading@10
|
660
|
yading@10
|
661
|
yading@10
|
662
|
yading@10
|
663 =head1 MUXERS
|
yading@10
|
664
|
yading@10
|
665
|
yading@10
|
666 Muxers are configured elements in FFmpeg which allow writing
|
yading@10
|
667 multimedia streams to a particular type of file.
|
yading@10
|
668
|
yading@10
|
669 When you configure your FFmpeg build, all the supported muxers
|
yading@10
|
670 are enabled by default. You can list all available muxers using the
|
yading@10
|
671 configure option C<--list-muxers>.
|
yading@10
|
672
|
yading@10
|
673 You can disable all the muxers with the configure option
|
yading@10
|
674 C<--disable-muxers> and selectively enable / disable single muxers
|
yading@10
|
675 with the options C<--enable-muxer=I<MUXER>> /
|
yading@10
|
676 C<--disable-muxer=I<MUXER>>.
|
yading@10
|
677
|
yading@10
|
678 The option C<-formats> of the ff* tools will display the list of
|
yading@10
|
679 enabled muxers.
|
yading@10
|
680
|
yading@10
|
681 A description of some of the currently available muxers follows.
|
yading@10
|
682
|
yading@10
|
683
|
yading@10
|
684
|
yading@10
|
685 =head2 crc
|
yading@10
|
686
|
yading@10
|
687
|
yading@10
|
688 CRC (Cyclic Redundancy Check) testing format.
|
yading@10
|
689
|
yading@10
|
690 This muxer computes and prints the Adler-32 CRC of all the input audio
|
yading@10
|
691 and video frames. By default audio frames are converted to signed
|
yading@10
|
692 16-bit raw audio and video frames to raw video before computing the
|
yading@10
|
693 CRC.
|
yading@10
|
694
|
yading@10
|
695 The output of the muxer consists of a single line of the form:
|
yading@10
|
696 CRC=0xI<CRC>, where I<CRC> is a hexadecimal number 0-padded to
|
yading@10
|
697 8 digits containing the CRC for all the decoded input frames.
|
yading@10
|
698
|
yading@10
|
699 For example to compute the CRC of the input, and store it in the file
|
yading@10
|
700 F<out.crc>:
|
yading@10
|
701
|
yading@10
|
702 ffmpeg -i INPUT -f crc out.crc
|
yading@10
|
703
|
yading@10
|
704
|
yading@10
|
705 You can print the CRC to stdout with the command:
|
yading@10
|
706
|
yading@10
|
707 ffmpeg -i INPUT -f crc -
|
yading@10
|
708
|
yading@10
|
709
|
yading@10
|
710 You can select the output format of each frame with B<ffmpeg> by
|
yading@10
|
711 specifying the audio and video codec and format. For example to
|
yading@10
|
712 compute the CRC of the input audio converted to PCM unsigned 8-bit
|
yading@10
|
713 and the input video converted to MPEG-2 video, use the command:
|
yading@10
|
714
|
yading@10
|
715 ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
|
yading@10
|
716
|
yading@10
|
717
|
yading@10
|
718 See also the framecrc muxer.
|
yading@10
|
719
|
yading@10
|
720
|
yading@10
|
721
|
yading@10
|
722 =head2 framecrc
|
yading@10
|
723
|
yading@10
|
724
|
yading@10
|
725 Per-packet CRC (Cyclic Redundancy Check) testing format.
|
yading@10
|
726
|
yading@10
|
727 This muxer computes and prints the Adler-32 CRC for each audio
|
yading@10
|
728 and video packet. By default audio frames are converted to signed
|
yading@10
|
729 16-bit raw audio and video frames to raw video before computing the
|
yading@10
|
730 CRC.
|
yading@10
|
731
|
yading@10
|
732 The output of the muxer consists of a line for each audio and video
|
yading@10
|
733 packet of the form:
|
yading@10
|
734
|
yading@10
|
735 <stream_index>, <packet_dts>, <packet_pts>, <packet_duration>, <packet_size>, 0x<CRC>
|
yading@10
|
736
|
yading@10
|
737
|
yading@10
|
738 I<CRC> is a hexadecimal number 0-padded to 8 digits containing the
|
yading@10
|
739 CRC of the packet.
|
yading@10
|
740
|
yading@10
|
741 For example to compute the CRC of the audio and video frames in
|
yading@10
|
742 F<INPUT>, converted to raw audio and video packets, and store it
|
yading@10
|
743 in the file F<out.crc>:
|
yading@10
|
744
|
yading@10
|
745 ffmpeg -i INPUT -f framecrc out.crc
|
yading@10
|
746
|
yading@10
|
747
|
yading@10
|
748 To print the information to stdout, use the command:
|
yading@10
|
749
|
yading@10
|
750 ffmpeg -i INPUT -f framecrc -
|
yading@10
|
751
|
yading@10
|
752
|
yading@10
|
753 With B<ffmpeg>, you can select the output format to which the
|
yading@10
|
754 audio and video frames are encoded before computing the CRC for each
|
yading@10
|
755 packet by specifying the audio and video codec. For example, to
|
yading@10
|
756 compute the CRC of each decoded input audio frame converted to PCM
|
yading@10
|
757 unsigned 8-bit and of each decoded input video frame converted to
|
yading@10
|
758 MPEG-2 video, use the command:
|
yading@10
|
759
|
yading@10
|
760 ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
|
yading@10
|
761
|
yading@10
|
762
|
yading@10
|
763 See also the crc muxer.
|
yading@10
|
764
|
yading@10
|
765
|
yading@10
|
766
|
yading@10
|
767 =head2 framemd5
|
yading@10
|
768
|
yading@10
|
769
|
yading@10
|
770 Per-packet MD5 testing format.
|
yading@10
|
771
|
yading@10
|
772 This muxer computes and prints the MD5 hash for each audio
|
yading@10
|
773 and video packet. By default audio frames are converted to signed
|
yading@10
|
774 16-bit raw audio and video frames to raw video before computing the
|
yading@10
|
775 hash.
|
yading@10
|
776
|
yading@10
|
777 The output of the muxer consists of a line for each audio and video
|
yading@10
|
778 packet of the form:
|
yading@10
|
779
|
yading@10
|
780 <stream_index>, <packet_dts>, <packet_pts>, <packet_duration>, <packet_size>, <MD5>
|
yading@10
|
781
|
yading@10
|
782
|
yading@10
|
783 I<MD5> is a hexadecimal number representing the computed MD5 hash
|
yading@10
|
784 for the packet.
|
yading@10
|
785
|
yading@10
|
786 For example to compute the MD5 of the audio and video frames in
|
yading@10
|
787 F<INPUT>, converted to raw audio and video packets, and store it
|
yading@10
|
788 in the file F<out.md5>:
|
yading@10
|
789
|
yading@10
|
790 ffmpeg -i INPUT -f framemd5 out.md5
|
yading@10
|
791
|
yading@10
|
792
|
yading@10
|
793 To print the information to stdout, use the command:
|
yading@10
|
794
|
yading@10
|
795 ffmpeg -i INPUT -f framemd5 -
|
yading@10
|
796
|
yading@10
|
797
|
yading@10
|
798 See also the md5 muxer.
|
yading@10
|
799
|
yading@10
|
800
|
yading@10
|
801
|
yading@10
|
802 =head2 hls
|
yading@10
|
803
|
yading@10
|
804
|
yading@10
|
805 Apple HTTP Live Streaming muxer that segments MPEG-TS according to
|
yading@10
|
806 the HTTP Live Streaming specification.
|
yading@10
|
807
|
yading@10
|
808 It creates a playlist file and numbered segment files. The output
|
yading@10
|
809 filename specifies the playlist filename; the segment filenames
|
yading@10
|
810 receive the same basename as the playlist, a sequential number and
|
yading@10
|
811 a .ts extension.
|
yading@10
|
812
|
yading@10
|
813
|
yading@10
|
814 ffmpeg -i in.nut out.m3u8
|
yading@10
|
815
|
yading@10
|
816
|
yading@10
|
817
|
yading@10
|
818 =over 4
|
yading@10
|
819
|
yading@10
|
820
|
yading@10
|
821 =item B<-hls_time> I<seconds>
|
yading@10
|
822
|
yading@10
|
823 Set the segment length in seconds.
|
yading@10
|
824
|
yading@10
|
825 =item B<-hls_list_size> I<size>
|
yading@10
|
826
|
yading@10
|
827 Set the maximum number of playlist entries.
|
yading@10
|
828
|
yading@10
|
829 =item B<-hls_wrap> I<wrap>
|
yading@10
|
830
|
yading@10
|
831 Set the number after which index wraps.
|
yading@10
|
832
|
yading@10
|
833 =item B<-start_number> I<number>
|
yading@10
|
834
|
yading@10
|
835 Start the sequence from I<number>.
|
yading@10
|
836
|
yading@10
|
837 =back
|
yading@10
|
838
|
yading@10
|
839
|
yading@10
|
840
|
yading@10
|
841
|
yading@10
|
842 =head2 ico
|
yading@10
|
843
|
yading@10
|
844
|
yading@10
|
845 ICO file muxer.
|
yading@10
|
846
|
yading@10
|
847 Microsoft's icon file format (ICO) has some strict limitations that should be noted:
|
yading@10
|
848
|
yading@10
|
849
|
yading@10
|
850 =over 4
|
yading@10
|
851
|
yading@10
|
852
|
yading@10
|
853 =item *
|
yading@10
|
854
|
yading@10
|
855 Size cannot exceed 256 pixels in any dimension
|
yading@10
|
856
|
yading@10
|
857
|
yading@10
|
858 =item *
|
yading@10
|
859
|
yading@10
|
860 Only BMP and PNG images can be stored
|
yading@10
|
861
|
yading@10
|
862
|
yading@10
|
863 =item *
|
yading@10
|
864
|
yading@10
|
865 If a BMP image is used, it must be one of the following pixel formats:
|
yading@10
|
866
|
yading@10
|
867 BMP Bit Depth FFmpeg Pixel Format
|
yading@10
|
868 1bit pal8
|
yading@10
|
869 4bit pal8
|
yading@10
|
870 8bit pal8
|
yading@10
|
871 16bit rgb555le
|
yading@10
|
872 24bit bgr24
|
yading@10
|
873 32bit bgra
|
yading@10
|
874
|
yading@10
|
875
|
yading@10
|
876
|
yading@10
|
877 =item *
|
yading@10
|
878
|
yading@10
|
879 If a BMP image is used, it must use the BITMAPINFOHEADER DIB header
|
yading@10
|
880
|
yading@10
|
881
|
yading@10
|
882 =item *
|
yading@10
|
883
|
yading@10
|
884 If a PNG image is used, it must use the rgba pixel format
|
yading@10
|
885
|
yading@10
|
886 =back
|
yading@10
|
887
|
yading@10
|
888
|
yading@10
|
889
|
yading@10
|
890
|
yading@10
|
891 =head2 image2
|
yading@10
|
892
|
yading@10
|
893
|
yading@10
|
894 Image file muxer.
|
yading@10
|
895
|
yading@10
|
896 The image file muxer writes video frames to image files.
|
yading@10
|
897
|
yading@10
|
898 The output filenames are specified by a pattern, which can be used to
|
yading@10
|
899 produce sequentially numbered series of files.
|
yading@10
|
900 The pattern may contain the string "%d" or "%0I<N>d", this string
|
yading@10
|
901 specifies the position of the characters representing a numbering in
|
yading@10
|
902 the filenames. If the form "%0I<N>d" is used, the string
|
yading@10
|
903 representing the number in each filename is 0-padded to I<N>
|
yading@10
|
904 digits. The literal character '%' can be specified in the pattern with
|
yading@10
|
905 the string "%%".
|
yading@10
|
906
|
yading@10
|
907 If the pattern contains "%d" or "%0I<N>d", the first filename of
|
yading@10
|
908 the file list specified will contain the number 1, all the following
|
yading@10
|
909 numbers will be sequential.
|
yading@10
|
910
|
yading@10
|
911 The pattern may contain a suffix which is used to automatically
|
yading@10
|
912 determine the format of the image files to write.
|
yading@10
|
913
|
yading@10
|
914 For example the pattern "img-%03d.bmp" will specify a sequence of
|
yading@10
|
915 filenames of the form F<img-001.bmp>, F<img-002.bmp>, ...,
|
yading@10
|
916 F<img-010.bmp>, etc.
|
yading@10
|
917 The pattern "img%%-%d.jpg" will specify a sequence of filenames of the
|
yading@10
|
918 form F<img%-1.jpg>, F<img%-2.jpg>, ..., F<img%-10.jpg>,
|
yading@10
|
919 etc.
|
yading@10
|
920
|
yading@10
|
921 The following example shows how to use B<ffmpeg> for creating a
|
yading@10
|
922 sequence of files F<img-001.jpeg>, F<img-002.jpeg>, ...,
|
yading@10
|
923 taking one image every second from the input video:
|
yading@10
|
924
|
yading@10
|
925 ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg'
|
yading@10
|
926
|
yading@10
|
927
|
yading@10
|
928 Note that with B<ffmpeg>, if the format is not specified with the
|
yading@10
|
929 C<-f> option and the output filename specifies an image file
|
yading@10
|
930 format, the image2 muxer is automatically selected, so the previous
|
yading@10
|
931 command can be written as:
|
yading@10
|
932
|
yading@10
|
933 ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg'
|
yading@10
|
934
|
yading@10
|
935
|
yading@10
|
936 Note also that the pattern must not necessarily contain "%d" or
|
yading@10
|
937 "%0I<N>d", for example to create a single image file
|
yading@10
|
938 F<img.jpeg> from the input video you can employ the command:
|
yading@10
|
939
|
yading@10
|
940 ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
|
yading@10
|
941
|
yading@10
|
942
|
yading@10
|
943
|
yading@10
|
944 =over 4
|
yading@10
|
945
|
yading@10
|
946
|
yading@10
|
947 =item B<start_number> I<number>
|
yading@10
|
948
|
yading@10
|
949 Start the sequence from I<number>. Default value is 1. Must be a
|
yading@10
|
950 positive number.
|
yading@10
|
951
|
yading@10
|
952
|
yading@10
|
953 =item B<-update> I<number>
|
yading@10
|
954
|
yading@10
|
955 If I<number> is nonzero, the filename will always be interpreted as just a
|
yading@10
|
956 filename, not a pattern, and this file will be continuously overwritten with new
|
yading@10
|
957 images.
|
yading@10
|
958
|
yading@10
|
959
|
yading@10
|
960 =back
|
yading@10
|
961
|
yading@10
|
962
|
yading@10
|
963 The image muxer supports the .Y.U.V image file format. This format is
|
yading@10
|
964 special in that that each image frame consists of three files, for
|
yading@10
|
965 each of the YUV420P components. To read or write this image file format,
|
yading@10
|
966 specify the name of the '.Y' file. The muxer will automatically open the
|
yading@10
|
967 '.U' and '.V' files as required.
|
yading@10
|
968
|
yading@10
|
969
|
yading@10
|
970
|
yading@10
|
971 =head2 md5
|
yading@10
|
972
|
yading@10
|
973
|
yading@10
|
974 MD5 testing format.
|
yading@10
|
975
|
yading@10
|
976 This muxer computes and prints the MD5 hash of all the input audio
|
yading@10
|
977 and video frames. By default audio frames are converted to signed
|
yading@10
|
978 16-bit raw audio and video frames to raw video before computing the
|
yading@10
|
979 hash.
|
yading@10
|
980
|
yading@10
|
981 The output of the muxer consists of a single line of the form:
|
yading@10
|
982 MD5=I<MD5>, where I<MD5> is a hexadecimal number representing
|
yading@10
|
983 the computed MD5 hash.
|
yading@10
|
984
|
yading@10
|
985 For example to compute the MD5 hash of the input converted to raw
|
yading@10
|
986 audio and video, and store it in the file F<out.md5>:
|
yading@10
|
987
|
yading@10
|
988 ffmpeg -i INPUT -f md5 out.md5
|
yading@10
|
989
|
yading@10
|
990
|
yading@10
|
991 You can print the MD5 to stdout with the command:
|
yading@10
|
992
|
yading@10
|
993 ffmpeg -i INPUT -f md5 -
|
yading@10
|
994
|
yading@10
|
995
|
yading@10
|
996 See also the framemd5 muxer.
|
yading@10
|
997
|
yading@10
|
998
|
yading@10
|
999 =head2 MOV/MP4/ISMV
|
yading@10
|
1000
|
yading@10
|
1001
|
yading@10
|
1002 The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4
|
yading@10
|
1003 file has all the metadata about all packets stored in one location
|
yading@10
|
1004 (written at the end of the file, it can be moved to the start for
|
yading@10
|
1005 better playback by adding I<faststart> to the I<movflags>, or
|
yading@10
|
1006 using the B<qt-faststart> tool). A fragmented
|
yading@10
|
1007 file consists of a number of fragments, where packets and metadata
|
yading@10
|
1008 about these packets are stored together. Writing a fragmented
|
yading@10
|
1009 file has the advantage that the file is decodable even if the
|
yading@10
|
1010 writing is interrupted (while a normal MOV/MP4 is undecodable if
|
yading@10
|
1011 it is not properly finished), and it requires less memory when writing
|
yading@10
|
1012 very long files (since writing normal MOV/MP4 files stores info about
|
yading@10
|
1013 every single packet in memory until the file is closed). The downside
|
yading@10
|
1014 is that it is less compatible with other applications.
|
yading@10
|
1015
|
yading@10
|
1016 Fragmentation is enabled by setting one of the AVOptions that define
|
yading@10
|
1017 how to cut the file into fragments:
|
yading@10
|
1018
|
yading@10
|
1019
|
yading@10
|
1020 =over 4
|
yading@10
|
1021
|
yading@10
|
1022
|
yading@10
|
1023 =item B<-moov_size> I<bytes>
|
yading@10
|
1024
|
yading@10
|
1025 Reserves space for the moov atom at the beginning of the file instead of placing the
|
yading@10
|
1026 moov atom at the end. If the space reserved is insufficient, muxing will fail.
|
yading@10
|
1027
|
yading@10
|
1028 =item B<-movflags frag_keyframe>
|
yading@10
|
1029
|
yading@10
|
1030 Start a new fragment at each video keyframe.
|
yading@10
|
1031
|
yading@10
|
1032 =item B<-frag_duration> I<duration>
|
yading@10
|
1033
|
yading@10
|
1034 Create fragments that are I<duration> microseconds long.
|
yading@10
|
1035
|
yading@10
|
1036 =item B<-frag_size> I<size>
|
yading@10
|
1037
|
yading@10
|
1038 Create fragments that contain up to I<size> bytes of payload data.
|
yading@10
|
1039
|
yading@10
|
1040 =item B<-movflags frag_custom>
|
yading@10
|
1041
|
yading@10
|
1042 Allow the caller to manually choose when to cut fragments, by
|
yading@10
|
1043 calling C<av_write_frame(ctx, NULL)> to write a fragment with
|
yading@10
|
1044 the packets written so far. (This is only useful with other
|
yading@10
|
1045 applications integrating libavformat, not from B<ffmpeg>.)
|
yading@10
|
1046
|
yading@10
|
1047 =item B<-min_frag_duration> I<duration>
|
yading@10
|
1048
|
yading@10
|
1049 Don't create fragments that are shorter than I<duration> microseconds long.
|
yading@10
|
1050
|
yading@10
|
1051 =back
|
yading@10
|
1052
|
yading@10
|
1053
|
yading@10
|
1054 If more than one condition is specified, fragments are cut when
|
yading@10
|
1055 one of the specified conditions is fulfilled. The exception to this is
|
yading@10
|
1056 C<-min_frag_duration>, which has to be fulfilled for any of the other
|
yading@10
|
1057 conditions to apply.
|
yading@10
|
1058
|
yading@10
|
1059 Additionally, the way the output file is written can be adjusted
|
yading@10
|
1060 through a few other options:
|
yading@10
|
1061
|
yading@10
|
1062
|
yading@10
|
1063 =over 4
|
yading@10
|
1064
|
yading@10
|
1065
|
yading@10
|
1066 =item B<-movflags empty_moov>
|
yading@10
|
1067
|
yading@10
|
1068 Write an initial moov atom directly at the start of the file, without
|
yading@10
|
1069 describing any samples in it. Generally, an mdat/moov pair is written
|
yading@10
|
1070 at the start of the file, as a normal MOV/MP4 file, containing only
|
yading@10
|
1071 a short portion of the file. With this option set, there is no initial
|
yading@10
|
1072 mdat atom, and the moov atom only describes the tracks but has
|
yading@10
|
1073 a zero duration.
|
yading@10
|
1074
|
yading@10
|
1075 Files written with this option set do not work in QuickTime.
|
yading@10
|
1076 This option is implicitly set when writing ismv (Smooth Streaming) files.
|
yading@10
|
1077
|
yading@10
|
1078 =item B<-movflags separate_moof>
|
yading@10
|
1079
|
yading@10
|
1080 Write a separate moof (movie fragment) atom for each track. Normally,
|
yading@10
|
1081 packets for all tracks are written in a moof atom (which is slightly
|
yading@10
|
1082 more efficient), but with this option set, the muxer writes one moof/mdat
|
yading@10
|
1083 pair for each track, making it easier to separate tracks.
|
yading@10
|
1084
|
yading@10
|
1085 This option is implicitly set when writing ismv (Smooth Streaming) files.
|
yading@10
|
1086
|
yading@10
|
1087 =item B<-movflags faststart>
|
yading@10
|
1088
|
yading@10
|
1089 Run a second pass moving the moov atom on top of the file. This
|
yading@10
|
1090 operation can take a while, and will not work in various situations such
|
yading@10
|
1091 as fragmented output, thus it is not enabled by default.
|
yading@10
|
1092
|
yading@10
|
1093 =item B<-movflags rtphint>
|
yading@10
|
1094
|
yading@10
|
1095 Add RTP hinting tracks to the output file.
|
yading@10
|
1096
|
yading@10
|
1097 =back
|
yading@10
|
1098
|
yading@10
|
1099
|
yading@10
|
1100 Smooth Streaming content can be pushed in real time to a publishing
|
yading@10
|
1101 point on IIS with this muxer. Example:
|
yading@10
|
1102
|
yading@10
|
1103 ffmpeg -re <<normal input/transcoding options>> -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
|
yading@10
|
1104
|
yading@10
|
1105
|
yading@10
|
1106
|
yading@10
|
1107 =head2 mpegts
|
yading@10
|
1108
|
yading@10
|
1109
|
yading@10
|
1110 MPEG transport stream muxer.
|
yading@10
|
1111
|
yading@10
|
1112 This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
|
yading@10
|
1113
|
yading@10
|
1114 The muxer options are:
|
yading@10
|
1115
|
yading@10
|
1116
|
yading@10
|
1117 =over 4
|
yading@10
|
1118
|
yading@10
|
1119
|
yading@10
|
1120 =item B<-mpegts_original_network_id> I<number>
|
yading@10
|
1121
|
yading@10
|
1122 Set the original_network_id (default 0x0001). This is unique identifier
|
yading@10
|
1123 of a network in DVB. Its main use is in the unique identification of a
|
yading@10
|
1124 service through the path Original_Network_ID, Transport_Stream_ID.
|
yading@10
|
1125
|
yading@10
|
1126 =item B<-mpegts_transport_stream_id> I<number>
|
yading@10
|
1127
|
yading@10
|
1128 Set the transport_stream_id (default 0x0001). This identifies a
|
yading@10
|
1129 transponder in DVB.
|
yading@10
|
1130
|
yading@10
|
1131 =item B<-mpegts_service_id> I<number>
|
yading@10
|
1132
|
yading@10
|
1133 Set the service_id (default 0x0001) also known as program in DVB.
|
yading@10
|
1134
|
yading@10
|
1135 =item B<-mpegts_pmt_start_pid> I<number>
|
yading@10
|
1136
|
yading@10
|
1137 Set the first PID for PMT (default 0x1000, max 0x1f00).
|
yading@10
|
1138
|
yading@10
|
1139 =item B<-mpegts_start_pid> I<number>
|
yading@10
|
1140
|
yading@10
|
1141 Set the first PID for data packets (default 0x0100, max 0x0f00).
|
yading@10
|
1142
|
yading@10
|
1143 =back
|
yading@10
|
1144
|
yading@10
|
1145
|
yading@10
|
1146 The recognized metadata settings in mpegts muxer are C<service_provider>
|
yading@10
|
1147 and C<service_name>. If they are not set the default for
|
yading@10
|
1148 C<service_provider> is "FFmpeg" and the default for
|
yading@10
|
1149 C<service_name> is "Service01".
|
yading@10
|
1150
|
yading@10
|
1151
|
yading@10
|
1152 ffmpeg -i file.mpg -c copy \
|
yading@10
|
1153 -mpegts_original_network_id 0x1122 \
|
yading@10
|
1154 -mpegts_transport_stream_id 0x3344 \
|
yading@10
|
1155 -mpegts_service_id 0x5566 \
|
yading@10
|
1156 -mpegts_pmt_start_pid 0x1500 \
|
yading@10
|
1157 -mpegts_start_pid 0x150 \
|
yading@10
|
1158 -metadata service_provider="Some provider" \
|
yading@10
|
1159 -metadata service_name="Some Channel" \
|
yading@10
|
1160 -y out.ts
|
yading@10
|
1161
|
yading@10
|
1162
|
yading@10
|
1163
|
yading@10
|
1164 =head2 null
|
yading@10
|
1165
|
yading@10
|
1166
|
yading@10
|
1167 Null muxer.
|
yading@10
|
1168
|
yading@10
|
1169 This muxer does not generate any output file, it is mainly useful for
|
yading@10
|
1170 testing or benchmarking purposes.
|
yading@10
|
1171
|
yading@10
|
1172 For example to benchmark decoding with B<ffmpeg> you can use the
|
yading@10
|
1173 command:
|
yading@10
|
1174
|
yading@10
|
1175 ffmpeg -benchmark -i INPUT -f null out.null
|
yading@10
|
1176
|
yading@10
|
1177
|
yading@10
|
1178 Note that the above command does not read or write the F<out.null>
|
yading@10
|
1179 file, but specifying the output file is required by the B<ffmpeg>
|
yading@10
|
1180 syntax.
|
yading@10
|
1181
|
yading@10
|
1182 Alternatively you can write the command as:
|
yading@10
|
1183
|
yading@10
|
1184 ffmpeg -benchmark -i INPUT -f null -
|
yading@10
|
1185
|
yading@10
|
1186
|
yading@10
|
1187
|
yading@10
|
1188 =head2 matroska
|
yading@10
|
1189
|
yading@10
|
1190
|
yading@10
|
1191 Matroska container muxer.
|
yading@10
|
1192
|
yading@10
|
1193 This muxer implements the matroska and webm container specs.
|
yading@10
|
1194
|
yading@10
|
1195 The recognized metadata settings in this muxer are:
|
yading@10
|
1196
|
yading@10
|
1197
|
yading@10
|
1198 =over 4
|
yading@10
|
1199
|
yading@10
|
1200
|
yading@10
|
1201
|
yading@10
|
1202 =item B<title=>I<title name>
|
yading@10
|
1203
|
yading@10
|
1204 Name provided to a single track
|
yading@10
|
1205
|
yading@10
|
1206 =back
|
yading@10
|
1207
|
yading@10
|
1208
|
yading@10
|
1209
|
yading@10
|
1210 =over 4
|
yading@10
|
1211
|
yading@10
|
1212
|
yading@10
|
1213
|
yading@10
|
1214 =item B<language=>I<language name>
|
yading@10
|
1215
|
yading@10
|
1216 Specifies the language of the track in the Matroska languages form
|
yading@10
|
1217
|
yading@10
|
1218 =back
|
yading@10
|
1219
|
yading@10
|
1220
|
yading@10
|
1221
|
yading@10
|
1222 =over 4
|
yading@10
|
1223
|
yading@10
|
1224
|
yading@10
|
1225
|
yading@10
|
1226 =item B<stereo_mode=>I<mode>
|
yading@10
|
1227
|
yading@10
|
1228 Stereo 3D video layout of two views in a single video track
|
yading@10
|
1229
|
yading@10
|
1230 =over 4
|
yading@10
|
1231
|
yading@10
|
1232
|
yading@10
|
1233 =item B<mono>
|
yading@10
|
1234
|
yading@10
|
1235 video is not stereo
|
yading@10
|
1236
|
yading@10
|
1237 =item B<left_right>
|
yading@10
|
1238
|
yading@10
|
1239 Both views are arranged side by side, Left-eye view is on the left
|
yading@10
|
1240
|
yading@10
|
1241 =item B<bottom_top>
|
yading@10
|
1242
|
yading@10
|
1243 Both views are arranged in top-bottom orientation, Left-eye view is at bottom
|
yading@10
|
1244
|
yading@10
|
1245 =item B<top_bottom>
|
yading@10
|
1246
|
yading@10
|
1247 Both views are arranged in top-bottom orientation, Left-eye view is on top
|
yading@10
|
1248
|
yading@10
|
1249 =item B<checkerboard_rl>
|
yading@10
|
1250
|
yading@10
|
1251 Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
|
yading@10
|
1252
|
yading@10
|
1253 =item B<checkerboard_lr>
|
yading@10
|
1254
|
yading@10
|
1255 Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
|
yading@10
|
1256
|
yading@10
|
1257 =item B<row_interleaved_rl>
|
yading@10
|
1258
|
yading@10
|
1259 Each view is constituted by a row based interleaving, Right-eye view is first row
|
yading@10
|
1260
|
yading@10
|
1261 =item B<row_interleaved_lr>
|
yading@10
|
1262
|
yading@10
|
1263 Each view is constituted by a row based interleaving, Left-eye view is first row
|
yading@10
|
1264
|
yading@10
|
1265 =item B<col_interleaved_rl>
|
yading@10
|
1266
|
yading@10
|
1267 Both views are arranged in a column based interleaving manner, Right-eye view is first column
|
yading@10
|
1268
|
yading@10
|
1269 =item B<col_interleaved_lr>
|
yading@10
|
1270
|
yading@10
|
1271 Both views are arranged in a column based interleaving manner, Left-eye view is first column
|
yading@10
|
1272
|
yading@10
|
1273 =item B<anaglyph_cyan_red>
|
yading@10
|
1274
|
yading@10
|
1275 All frames are in anaglyph format viewable through red-cyan filters
|
yading@10
|
1276
|
yading@10
|
1277 =item B<right_left>
|
yading@10
|
1278
|
yading@10
|
1279 Both views are arranged side by side, Right-eye view is on the left
|
yading@10
|
1280
|
yading@10
|
1281 =item B<anaglyph_green_magenta>
|
yading@10
|
1282
|
yading@10
|
1283 All frames are in anaglyph format viewable through green-magenta filters
|
yading@10
|
1284
|
yading@10
|
1285 =item B<block_lr>
|
yading@10
|
1286
|
yading@10
|
1287 Both eyes laced in one Block, Left-eye view is first
|
yading@10
|
1288
|
yading@10
|
1289 =item B<block_rl>
|
yading@10
|
1290
|
yading@10
|
1291 Both eyes laced in one Block, Right-eye view is first
|
yading@10
|
1292
|
yading@10
|
1293 =back
|
yading@10
|
1294
|
yading@10
|
1295
|
yading@10
|
1296 =back
|
yading@10
|
1297
|
yading@10
|
1298
|
yading@10
|
1299 For example a 3D WebM clip can be created using the following command line:
|
yading@10
|
1300
|
yading@10
|
1301 ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
|
yading@10
|
1302
|
yading@10
|
1303
|
yading@10
|
1304
|
yading@10
|
1305 =head2 segment, stream_segment, ssegment
|
yading@10
|
1306
|
yading@10
|
1307
|
yading@10
|
1308 Basic stream segmenter.
|
yading@10
|
1309
|
yading@10
|
1310 The segmenter muxer outputs streams to a number of separate files of nearly
|
yading@10
|
1311 fixed duration. Output filename pattern can be set in a fashion similar to
|
yading@10
|
1312 image2.
|
yading@10
|
1313
|
yading@10
|
1314 C<stream_segment> is a variant of the muxer used to write to
|
yading@10
|
1315 streaming output formats, i.e. which do not require global headers,
|
yading@10
|
1316 and is recommended for outputting e.g. to MPEG transport stream segments.
|
yading@10
|
1317 C<ssegment> is a shorter alias for C<stream_segment>.
|
yading@10
|
1318
|
yading@10
|
1319 Every segment starts with a keyframe of the selected reference stream,
|
yading@10
|
1320 which is set through the B<reference_stream> option.
|
yading@10
|
1321
|
yading@10
|
1322 Note that if you want accurate splitting for a video file, you need to
|
yading@10
|
1323 make the input key frames correspond to the exact splitting times
|
yading@10
|
1324 expected by the segmenter, or the segment muxer will start the new
|
yading@10
|
1325 segment with the key frame found next after the specified start
|
yading@10
|
1326 time.
|
yading@10
|
1327
|
yading@10
|
1328 The segment muxer works best with a single constant frame rate video.
|
yading@10
|
1329
|
yading@10
|
1330 Optionally it can generate a list of the created segments, by setting
|
yading@10
|
1331 the option I<segment_list>. The list type is specified by the
|
yading@10
|
1332 I<segment_list_type> option.
|
yading@10
|
1333
|
yading@10
|
1334 The segment muxer supports the following options:
|
yading@10
|
1335
|
yading@10
|
1336
|
yading@10
|
1337 =over 4
|
yading@10
|
1338
|
yading@10
|
1339
|
yading@10
|
1340 =item B<reference_stream> I<specifier>
|
yading@10
|
1341
|
yading@10
|
1342 Set the reference stream, as specified by the string I<specifier>.
|
yading@10
|
1343 If I<specifier> is set to C<auto>, the reference is choosen
|
yading@10
|
1344 automatically. Otherwise it must be a stream specifier (see the ``Stream
|
yading@10
|
1345 specifiers'' chapter in the ffmpeg manual) which specifies the
|
yading@10
|
1346 reference stream. The default value is ``auto''.
|
yading@10
|
1347
|
yading@10
|
1348
|
yading@10
|
1349 =item B<segment_format> I<format>
|
yading@10
|
1350
|
yading@10
|
1351 Override the inner container format, by default it is guessed by the filename
|
yading@10
|
1352 extension.
|
yading@10
|
1353
|
yading@10
|
1354
|
yading@10
|
1355 =item B<segment_list> I<name>
|
yading@10
|
1356
|
yading@10
|
1357 Generate also a listfile named I<name>. If not specified no
|
yading@10
|
1358 listfile is generated.
|
yading@10
|
1359
|
yading@10
|
1360
|
yading@10
|
1361 =item B<segment_list_flags> I<flags>
|
yading@10
|
1362
|
yading@10
|
1363 Set flags affecting the segment list generation.
|
yading@10
|
1364
|
yading@10
|
1365 It currently supports the following flags:
|
yading@10
|
1366
|
yading@10
|
1367 =over 4
|
yading@10
|
1368
|
yading@10
|
1369
|
yading@10
|
1370 =item I<cache>
|
yading@10
|
1371
|
yading@10
|
1372 Allow caching (only affects M3U8 list files).
|
yading@10
|
1373
|
yading@10
|
1374
|
yading@10
|
1375 =item I<live>
|
yading@10
|
1376
|
yading@10
|
1377 Allow live-friendly file generation.
|
yading@10
|
1378
|
yading@10
|
1379 =back
|
yading@10
|
1380
|
yading@10
|
1381
|
yading@10
|
1382 Default value is C<cache>.
|
yading@10
|
1383
|
yading@10
|
1384
|
yading@10
|
1385 =item B<segment_list_size> I<size>
|
yading@10
|
1386
|
yading@10
|
1387 Update the list file so that it contains at most the last I<size>
|
yading@10
|
1388 segments. If 0 the list file will contain all the segments. Default
|
yading@10
|
1389 value is 0.
|
yading@10
|
1390
|
yading@10
|
1391
|
yading@10
|
1392 =item B<segment_list type> I<type>
|
yading@10
|
1393
|
yading@10
|
1394 Specify the format for the segment list file.
|
yading@10
|
1395
|
yading@10
|
1396 The following values are recognized:
|
yading@10
|
1397
|
yading@10
|
1398 =over 4
|
yading@10
|
1399
|
yading@10
|
1400
|
yading@10
|
1401 =item B<flat>
|
yading@10
|
1402
|
yading@10
|
1403 Generate a flat list for the created segments, one segment per line.
|
yading@10
|
1404
|
yading@10
|
1405
|
yading@10
|
1406 =item B<csv, ext>
|
yading@10
|
1407
|
yading@10
|
1408 Generate a list for the created segments, one segment per line,
|
yading@10
|
1409 each line matching the format (comma-separated values):
|
yading@10
|
1410
|
yading@10
|
1411 <segment_filename>,<segment_start_time>,<segment_end_time>
|
yading@10
|
1412
|
yading@10
|
1413
|
yading@10
|
1414 I<segment_filename> is the name of the output file generated by the
|
yading@10
|
1415 muxer according to the provided pattern. CSV escaping (according to
|
yading@10
|
1416 RFC4180) is applied if required.
|
yading@10
|
1417
|
yading@10
|
1418 I<segment_start_time> and I<segment_end_time> specify
|
yading@10
|
1419 the segment start and end time expressed in seconds.
|
yading@10
|
1420
|
yading@10
|
1421 A list file with the suffix C<".csv"> or C<".ext"> will
|
yading@10
|
1422 auto-select this format.
|
yading@10
|
1423
|
yading@10
|
1424 C<ext> is deprecated in favor or C<csv>.
|
yading@10
|
1425
|
yading@10
|
1426
|
yading@10
|
1427 =item B<ffconcat>
|
yading@10
|
1428
|
yading@10
|
1429 Generate an ffconcat file for the created segments. The resulting file
|
yading@10
|
1430 can be read using the FFmpeg concat demuxer.
|
yading@10
|
1431
|
yading@10
|
1432 A list file with the suffix C<".ffcat"> or C<".ffconcat"> will
|
yading@10
|
1433 auto-select this format.
|
yading@10
|
1434
|
yading@10
|
1435
|
yading@10
|
1436 =item B<m3u8>
|
yading@10
|
1437
|
yading@10
|
1438 Generate an extended M3U8 file, version 3, compliant with
|
yading@10
|
1439 E<lt>B<http://tools.ietf.org/id/draft-pantos-http-live-streaming>E<gt>.
|
yading@10
|
1440
|
yading@10
|
1441 A list file with the suffix C<".m3u8"> will auto-select this format.
|
yading@10
|
1442
|
yading@10
|
1443 =back
|
yading@10
|
1444
|
yading@10
|
1445
|
yading@10
|
1446 If not specified the type is guessed from the list file name suffix.
|
yading@10
|
1447
|
yading@10
|
1448
|
yading@10
|
1449 =item B<segment_time> I<time>
|
yading@10
|
1450
|
yading@10
|
1451 Set segment duration to I<time>, the value must be a duration
|
yading@10
|
1452 specification. Default value is "2". See also the
|
yading@10
|
1453 B<segment_times> option.
|
yading@10
|
1454
|
yading@10
|
1455 Note that splitting may not be accurate, unless you force the
|
yading@10
|
1456 reference stream key-frames at the given time. See the introductory
|
yading@10
|
1457 notice and the examples below.
|
yading@10
|
1458
|
yading@10
|
1459
|
yading@10
|
1460 =item B<segment_time_delta> I<delta>
|
yading@10
|
1461
|
yading@10
|
1462 Specify the accuracy time when selecting the start time for a
|
yading@10
|
1463 segment, expressed as a duration specification. Default value is "0".
|
yading@10
|
1464
|
yading@10
|
1465 When delta is specified a key-frame will start a new segment if its
|
yading@10
|
1466 PTS satisfies the relation:
|
yading@10
|
1467
|
yading@10
|
1468 PTS >= start_time - time_delta
|
yading@10
|
1469
|
yading@10
|
1470
|
yading@10
|
1471 This option is useful when splitting video content, which is always
|
yading@10
|
1472 split at GOP boundaries, in case a key frame is found just before the
|
yading@10
|
1473 specified split time.
|
yading@10
|
1474
|
yading@10
|
1475 In particular may be used in combination with the F<ffmpeg> option
|
yading@10
|
1476 I<force_key_frames>. The key frame times specified by
|
yading@10
|
1477 I<force_key_frames> may not be set accurately because of rounding
|
yading@10
|
1478 issues, with the consequence that a key frame time may result set just
|
yading@10
|
1479 before the specified time. For constant frame rate videos a value of
|
yading@10
|
1480 1/2*I<frame_rate> should address the worst case mismatch between
|
yading@10
|
1481 the specified time and the time set by I<force_key_frames>.
|
yading@10
|
1482
|
yading@10
|
1483
|
yading@10
|
1484 =item B<segment_times> I<times>
|
yading@10
|
1485
|
yading@10
|
1486 Specify a list of split points. I<times> contains a list of comma
|
yading@10
|
1487 separated duration specifications, in increasing order. See also
|
yading@10
|
1488 the B<segment_time> option.
|
yading@10
|
1489
|
yading@10
|
1490
|
yading@10
|
1491 =item B<segment_frames> I<frames>
|
yading@10
|
1492
|
yading@10
|
1493 Specify a list of split video frame numbers. I<frames> contains a
|
yading@10
|
1494 list of comma separated integer numbers, in increasing order.
|
yading@10
|
1495
|
yading@10
|
1496 This option specifies to start a new segment whenever a reference
|
yading@10
|
1497 stream key frame is found and the sequential number (starting from 0)
|
yading@10
|
1498 of the frame is greater or equal to the next value in the list.
|
yading@10
|
1499
|
yading@10
|
1500
|
yading@10
|
1501 =item B<segment_wrap> I<limit>
|
yading@10
|
1502
|
yading@10
|
1503 Wrap around segment index once it reaches I<limit>.
|
yading@10
|
1504
|
yading@10
|
1505
|
yading@10
|
1506 =item B<segment_start_number> I<number>
|
yading@10
|
1507
|
yading@10
|
1508 Set the sequence number of the first segment. Defaults to C<0>.
|
yading@10
|
1509
|
yading@10
|
1510
|
yading@10
|
1511 =item B<reset_timestamps> I<1|0>
|
yading@10
|
1512
|
yading@10
|
1513 Reset timestamps at the begin of each segment, so that each segment
|
yading@10
|
1514 will start with near-zero timestamps. It is meant to ease the playback
|
yading@10
|
1515 of the generated segments. May not work with some combinations of
|
yading@10
|
1516 muxers/codecs. It is set to C<0> by default.
|
yading@10
|
1517
|
yading@10
|
1518 =back
|
yading@10
|
1519
|
yading@10
|
1520
|
yading@10
|
1521
|
yading@10
|
1522 =head3 Examples
|
yading@10
|
1523
|
yading@10
|
1524
|
yading@10
|
1525
|
yading@10
|
1526 =over 4
|
yading@10
|
1527
|
yading@10
|
1528
|
yading@10
|
1529 =item *
|
yading@10
|
1530
|
yading@10
|
1531 To remux the content of file F<in.mkv> to a list of segments
|
yading@10
|
1532 F<out-000.nut>, F<out-001.nut>, etc., and write the list of
|
yading@10
|
1533 generated segments to F<out.list>:
|
yading@10
|
1534
|
yading@10
|
1535 ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.list out%03d.nut
|
yading@10
|
1536
|
yading@10
|
1537
|
yading@10
|
1538
|
yading@10
|
1539 =item *
|
yading@10
|
1540
|
yading@10
|
1541 As the example above, but segment the input file according to the split
|
yading@10
|
1542 points specified by the I<segment_times> option:
|
yading@10
|
1543
|
yading@10
|
1544 ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 out%03d.nut
|
yading@10
|
1545
|
yading@10
|
1546
|
yading@10
|
1547
|
yading@10
|
1548 =item *
|
yading@10
|
1549
|
yading@10
|
1550 As the example above, but use the C<ffmpeg> I<force_key_frames>
|
yading@10
|
1551 option to force key frames in the input at the specified location, together
|
yading@10
|
1552 with the segment option I<segment_time_delta> to account for
|
yading@10
|
1553 possible roundings operated when setting key frame times.
|
yading@10
|
1554
|
yading@10
|
1555 ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -codec:v mpeg4 -codec:a pcm_s16le -map 0 \
|
yading@10
|
1556 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
|
yading@10
|
1557
|
yading@10
|
1558 In order to force key frames on the input file, transcoding is
|
yading@10
|
1559 required.
|
yading@10
|
1560
|
yading@10
|
1561
|
yading@10
|
1562 =item *
|
yading@10
|
1563
|
yading@10
|
1564 Segment the input file by splitting the input file according to the
|
yading@10
|
1565 frame numbers sequence specified with the I<segment_frames> option:
|
yading@10
|
1566
|
yading@10
|
1567 ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_frames 100,200,300,500,800 out%03d.nut
|
yading@10
|
1568
|
yading@10
|
1569
|
yading@10
|
1570
|
yading@10
|
1571 =item *
|
yading@10
|
1572
|
yading@10
|
1573 To convert the F<in.mkv> to TS segments using the C<libx264>
|
yading@10
|
1574 and C<libfaac> encoders:
|
yading@10
|
1575
|
yading@10
|
1576 ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a libfaac -f ssegment -segment_list out.list out%03d.ts
|
yading@10
|
1577
|
yading@10
|
1578
|
yading@10
|
1579
|
yading@10
|
1580 =item *
|
yading@10
|
1581
|
yading@10
|
1582 Segment the input file, and create an M3U8 live playlist (can be used
|
yading@10
|
1583 as live HLS source):
|
yading@10
|
1584
|
yading@10
|
1585 ffmpeg -re -i in.mkv -codec copy -map 0 -f segment -segment_list playlist.m3u8 \
|
yading@10
|
1586 -segment_list_flags +live -segment_time 10 out%03d.mkv
|
yading@10
|
1587
|
yading@10
|
1588
|
yading@10
|
1589 =back
|
yading@10
|
1590
|
yading@10
|
1591
|
yading@10
|
1592
|
yading@10
|
1593 =head2 mp3
|
yading@10
|
1594
|
yading@10
|
1595
|
yading@10
|
1596 The MP3 muxer writes a raw MP3 stream with an ID3v2 header at the beginning and
|
yading@10
|
1597 optionally an ID3v1 tag at the end. ID3v2.3 and ID3v2.4 are supported, the
|
yading@10
|
1598 C<id3v2_version> option controls which one is used. The legacy ID3v1 tag is
|
yading@10
|
1599 not written by default, but may be enabled with the C<write_id3v1> option.
|
yading@10
|
1600
|
yading@10
|
1601 For seekable output the muxer also writes a Xing frame at the beginning, which
|
yading@10
|
1602 contains the number of frames in the file. It is useful for computing duration
|
yading@10
|
1603 of VBR files.
|
yading@10
|
1604
|
yading@10
|
1605 The muxer supports writing ID3v2 attached pictures (APIC frames). The pictures
|
yading@10
|
1606 are supplied to the muxer in form of a video stream with a single packet. There
|
yading@10
|
1607 can be any number of those streams, each will correspond to a single APIC frame.
|
yading@10
|
1608 The stream metadata tags I<title> and I<comment> map to APIC
|
yading@10
|
1609 I<description> and I<picture type> respectively. See
|
yading@10
|
1610 E<lt>B<http://id3.org/id3v2.4.0-frames>E<gt> for allowed picture types.
|
yading@10
|
1611
|
yading@10
|
1612 Note that the APIC frames must be written at the beginning, so the muxer will
|
yading@10
|
1613 buffer the audio frames until it gets all the pictures. It is therefore advised
|
yading@10
|
1614 to provide the pictures as soon as possible to avoid excessive buffering.
|
yading@10
|
1615
|
yading@10
|
1616 Examples:
|
yading@10
|
1617
|
yading@10
|
1618 Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
|
yading@10
|
1619
|
yading@10
|
1620 ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
|
yading@10
|
1621
|
yading@10
|
1622
|
yading@10
|
1623 To attach a picture to an mp3 file select both the audio and the picture stream
|
yading@10
|
1624 with C<map>:
|
yading@10
|
1625
|
yading@10
|
1626 ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1
|
yading@10
|
1627 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3
|
yading@10
|
1628
|
yading@10
|
1629
|
yading@10
|
1630
|
yading@10
|
1631 =head2 ogg
|
yading@10
|
1632
|
yading@10
|
1633
|
yading@10
|
1634 Ogg container muxer.
|
yading@10
|
1635
|
yading@10
|
1636
|
yading@10
|
1637 =over 4
|
yading@10
|
1638
|
yading@10
|
1639
|
yading@10
|
1640 =item B<-page_duration> I<duration>
|
yading@10
|
1641
|
yading@10
|
1642 Preferred page duration, in microseconds. The muxer will attempt to create
|
yading@10
|
1643 pages that are approximately I<duration> microseconds long. This allows the
|
yading@10
|
1644 user to compromise between seek granularity and container overhead. The default
|
yading@10
|
1645 is 1 second. A value of 0 will fill all segments, making pages as large as
|
yading@10
|
1646 possible. A value of 1 will effectively use 1 packet-per-page in most
|
yading@10
|
1647 situations, giving a small seek granularity at the cost of additional container
|
yading@10
|
1648 overhead.
|
yading@10
|
1649
|
yading@10
|
1650 =back
|
yading@10
|
1651
|
yading@10
|
1652
|
yading@10
|
1653
|
yading@10
|
1654 =head2 tee
|
yading@10
|
1655
|
yading@10
|
1656
|
yading@10
|
1657 The tee muxer can be used to write the same data to several files or any
|
yading@10
|
1658 other kind of muxer. It can be used, for example, to both stream a video to
|
yading@10
|
1659 the network and save it to disk at the same time.
|
yading@10
|
1660
|
yading@10
|
1661 It is different from specifying several outputs to the B<ffmpeg>
|
yading@10
|
1662 command-line tool because the audio and video data will be encoded only once
|
yading@10
|
1663 with the tee muxer; encoding can be a very expensive process. It is not
|
yading@10
|
1664 useful when using the libavformat API directly because it is then possible
|
yading@10
|
1665 to feed the same packets to several muxers directly.
|
yading@10
|
1666
|
yading@10
|
1667 The slave outputs are specified in the file name given to the muxer,
|
yading@10
|
1668 separated by '|'. If any of the slave name contains the '|' separator,
|
yading@10
|
1669 leading or trailing spaces or any special character, it must be
|
yading@10
|
1670 escaped (see the ``Quoting and escaping'' section in the ffmpeg-utils
|
yading@10
|
1671 manual).
|
yading@10
|
1672
|
yading@10
|
1673 Options can be specified for each slave by prepending them as a list of
|
yading@10
|
1674 I<key>=I<value> pairs separated by ':', between square brackets. If
|
yading@10
|
1675 the options values contain a special character or the ':' separator, they
|
yading@10
|
1676 must be escaped; note that this is a second level escaping.
|
yading@10
|
1677
|
yading@10
|
1678 Example: encode something and both archive it in a WebM file and stream it
|
yading@10
|
1679 as MPEG-TS over UDP (the streams need to be explicitly mapped):
|
yading@10
|
1680
|
yading@10
|
1681
|
yading@10
|
1682 ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
|
yading@10
|
1683 "archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
|
yading@10
|
1684
|
yading@10
|
1685
|
yading@10
|
1686 Note: some codecs may need different options depending on the output format;
|
yading@10
|
1687 the auto-detection of this can not work with the tee muxer. The main example
|
yading@10
|
1688 is the B<global_header> flag.
|
yading@10
|
1689
|
yading@10
|
1690
|
yading@10
|
1691 =head1 METADATA
|
yading@10
|
1692
|
yading@10
|
1693
|
yading@10
|
1694 FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
|
yading@10
|
1695 INI-like text file and then load it back using the metadata muxer/demuxer.
|
yading@10
|
1696
|
yading@10
|
1697 The file format is as follows:
|
yading@10
|
1698
|
yading@10
|
1699 =over 4
|
yading@10
|
1700
|
yading@10
|
1701
|
yading@10
|
1702
|
yading@10
|
1703 =item 1.
|
yading@10
|
1704
|
yading@10
|
1705 A file consists of a header and a number of metadata tags divided into sections,
|
yading@10
|
1706 each on its own line.
|
yading@10
|
1707
|
yading@10
|
1708
|
yading@10
|
1709 =item 2.
|
yading@10
|
1710
|
yading@10
|
1711 The header is a ';FFMETADATA' string, followed by a version number (now 1).
|
yading@10
|
1712
|
yading@10
|
1713
|
yading@10
|
1714 =item 3.
|
yading@10
|
1715
|
yading@10
|
1716 Metadata tags are of the form 'key=value'
|
yading@10
|
1717
|
yading@10
|
1718
|
yading@10
|
1719 =item 4.
|
yading@10
|
1720
|
yading@10
|
1721 Immediately after header follows global metadata
|
yading@10
|
1722
|
yading@10
|
1723
|
yading@10
|
1724 =item 5.
|
yading@10
|
1725
|
yading@10
|
1726 After global metadata there may be sections with per-stream/per-chapter
|
yading@10
|
1727 metadata.
|
yading@10
|
1728
|
yading@10
|
1729
|
yading@10
|
1730 =item 6.
|
yading@10
|
1731
|
yading@10
|
1732 A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
|
yading@10
|
1733 brackets ('[', ']') and ends with next section or end of file.
|
yading@10
|
1734
|
yading@10
|
1735
|
yading@10
|
1736 =item 7.
|
yading@10
|
1737
|
yading@10
|
1738 At the beginning of a chapter section there may be an optional timebase to be
|
yading@10
|
1739 used for start/end values. It must be in form 'TIMEBASE=num/den', where num and
|
yading@10
|
1740 den are integers. If the timebase is missing then start/end times are assumed to
|
yading@10
|
1741 be in milliseconds.
|
yading@10
|
1742 Next a chapter section must contain chapter start and end times in form
|
yading@10
|
1743 'START=num', 'END=num', where num is a positive integer.
|
yading@10
|
1744
|
yading@10
|
1745
|
yading@10
|
1746 =item 8.
|
yading@10
|
1747
|
yading@10
|
1748 Empty lines and lines starting with ';' or '#' are ignored.
|
yading@10
|
1749
|
yading@10
|
1750
|
yading@10
|
1751 =item 9.
|
yading@10
|
1752
|
yading@10
|
1753 Metadata keys or values containing special characters ('=', ';', '#', '\' and a
|
yading@10
|
1754 newline) must be escaped with a backslash '\'.
|
yading@10
|
1755
|
yading@10
|
1756
|
yading@10
|
1757 =item 10.
|
yading@10
|
1758
|
yading@10
|
1759 Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
|
yading@10
|
1760 the tag (in the example above key is 'foo ', value is ' bar').
|
yading@10
|
1761
|
yading@10
|
1762 =back
|
yading@10
|
1763
|
yading@10
|
1764
|
yading@10
|
1765 A ffmetadata file might look like this:
|
yading@10
|
1766
|
yading@10
|
1767 ;FFMETADATA1
|
yading@10
|
1768 title=bike\\shed
|
yading@10
|
1769 ;this is a comment
|
yading@10
|
1770 artist=FFmpeg troll team
|
yading@10
|
1771
|
yading@10
|
1772 [CHAPTER]
|
yading@10
|
1773 TIMEBASE=1/1000
|
yading@10
|
1774 START=0
|
yading@10
|
1775 #chapter ends at 0:01:00
|
yading@10
|
1776 END=60000
|
yading@10
|
1777 title=chapter \#1
|
yading@10
|
1778 [STREAM]
|
yading@10
|
1779 title=multi\
|
yading@10
|
1780 line
|
yading@10
|
1781
|
yading@10
|
1782
|
yading@10
|
1783
|
yading@10
|
1784 =head1 SEE ALSO
|
yading@10
|
1785
|
yading@10
|
1786
|
yading@10
|
1787
|
yading@10
|
1788 ffmpeg(1), ffplay(1), ffprobe(1), ffserver(1), libavformat(3)
|
yading@10
|
1789
|
yading@10
|
1790
|
yading@10
|
1791 =head1 AUTHORS
|
yading@10
|
1792
|
yading@10
|
1793
|
yading@10
|
1794 The FFmpeg developers.
|
yading@10
|
1795
|
yading@10
|
1796 For details about the authorship, see the Git history of the project
|
yading@10
|
1797 (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
|
yading@10
|
1798 B<git log> in the FFmpeg source directory, or browsing the
|
yading@10
|
1799 online repository at E<lt>B<http://source.ffmpeg.org>E<gt>.
|
yading@10
|
1800
|
yading@10
|
1801 Maintainers for the specific components are listed in the file
|
yading@10
|
1802 F<MAINTAINERS> in the source code tree.
|
yading@10
|
1803
|
yading@10
|
1804
|
yading@10
|
1805
|