3 <!-- Created on December 14, 2013 by texi2html 1.82 -->
5 texi2html was written by:
6 Lionel Cons <Lionel.Cons@cern.ch> (original author)
7 Karl Berry <karl@freefriends.org>
8 Olaf Bachmann <obachman@mathematik.uni-kl.de>
10 Maintained by: Many creative people.
11 Send bugs and suggestions to <texi2html-bug@nongnu.org>
15 <title>FFmpeg documentation : FFmpeg Formats </title>
17 <meta name="description" content="FFmpeg Formats Documentation: ">
18 <meta name="keywords" content="FFmpeg documentation : FFmpeg Formats ">
19 <meta name="Generator" content="texi2html 1.82">
20 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
21 <link rel="stylesheet" type="text/css" href="default.css" />
23 <link rel="icon" href="favicon.png" type="image/png" />
29 <a name="SEC_Top"></a>
30 <h1 class="settitle">FFmpeg Formats Documentation</h1>
32 <a name="SEC_Contents"></a>
33 <h1>Table of Contents</h1>
34 <div class="contents">
37 <li><a name="toc-Description" href="#Description">1. Description</a></li>
38 <li><a name="toc-Format-Options" href="#Format-Options">2. Format Options</a>
40 <li><a name="toc-Format-stream-specifiers-1" href="#Format-stream-specifiers-1">2.1 Format stream specifiers</a></li>
42 <li><a name="toc-Demuxers" href="#Demuxers">3. Demuxers</a>
44 <li><a name="toc-applehttp" href="#applehttp">3.1 applehttp</a></li>
45 <li><a name="toc-asf" href="#asf">3.2 asf</a></li>
46 <li><a name="toc-concat-1" href="#concat-1">3.3 concat</a>
48 <li><a name="toc-Syntax" href="#Syntax">3.3.1 Syntax</a></li>
49 <li><a name="toc-Options" href="#Options">3.3.2 Options</a></li>
51 <li><a name="toc-flv" href="#flv">3.4 flv</a></li>
52 <li><a name="toc-libgme" href="#libgme">3.5 libgme</a></li>
53 <li><a name="toc-libquvi" href="#libquvi">3.6 libquvi</a></li>
54 <li><a name="toc-image2-2" href="#image2-2">3.7 image2</a>
56 <li><a name="toc-Examples-1" href="#Examples-1">3.7.1 Examples</a></li>
58 <li><a name="toc-mpegts-1" href="#mpegts-1">3.8 mpegts</a></li>
59 <li><a name="toc-rawvideo" href="#rawvideo">3.9 rawvideo</a></li>
60 <li><a name="toc-sbg" href="#sbg">3.10 sbg</a></li>
61 <li><a name="toc-tedcaptions" href="#tedcaptions">3.11 tedcaptions</a></li>
63 <li><a name="toc-Muxers" href="#Muxers">4. Muxers</a>
65 <li><a name="toc-aiff-1" href="#aiff-1">4.1 aiff</a></li>
66 <li><a name="toc-crc-1" href="#crc-1">4.2 crc</a></li>
67 <li><a name="toc-framecrc-1" href="#framecrc-1">4.3 framecrc</a></li>
68 <li><a name="toc-framemd5-1" href="#framemd5-1">4.4 framemd5</a></li>
69 <li><a name="toc-gif-1" href="#gif-1">4.5 gif</a></li>
70 <li><a name="toc-hls-1" href="#hls-1">4.6 hls</a></li>
71 <li><a name="toc-ico-1" href="#ico-1">4.7 ico</a></li>
72 <li><a name="toc-image2-1" href="#image2-1">4.8 image2</a></li>
73 <li><a name="toc-matroska" href="#matroska">4.9 matroska</a></li>
74 <li><a name="toc-md5-1" href="#md5-1">4.10 md5</a></li>
75 <li><a name="toc-mov_002fmp4_002fismv" href="#mov_002fmp4_002fismv">4.11 mov/mp4/ismv</a></li>
76 <li><a name="toc-mp3" href="#mp3">4.12 mp3</a></li>
77 <li><a name="toc-mpegts" href="#mpegts">4.13 mpegts</a></li>
78 <li><a name="toc-null" href="#null">4.14 null</a></li>
79 <li><a name="toc-ogg" href="#ogg">4.15 ogg</a></li>
80 <li><a name="toc-segment_002c-stream_005fsegment_002c-ssegment" href="#segment_002c-stream_005fsegment_002c-ssegment">4.16 segment, stream_segment, ssegment</a>
82 <li><a name="toc-Examples" href="#Examples">4.16.1 Examples</a></li>
84 <li><a name="toc-tee" href="#tee">4.17 tee</a></li>
86 <li><a name="toc-Metadata" href="#Metadata">5. Metadata</a></li>
87 <li><a name="toc-See-Also" href="#See-Also">6. See Also</a></li>
88 <li><a name="toc-Authors" href="#Authors">7. Authors</a></li>
92 <a name="Description"></a>
93 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Description">1. Description</a></h1>
95 <p>This document describes the supported formats (muxers and demuxers)
96 provided by the libavformat library.
99 <a name="Format-Options"></a>
100 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Format-Options">2. Format Options</a></h1>
102 <p>The libavformat library provides some generic global options, which
103 can be set on all the muxers and demuxers. In addition each muxer or
104 demuxer may support so-called private options, which are specific for
107 <p>Options may be set by specifying -<var>option</var> <var>value</var> in the
108 FFmpeg tools, or by setting the value explicitly in the
109 <code>AVFormatContext</code> options or using the ‘<tt>libavutil/opt.h</tt>’ API
110 for programmatic use.
112 <p>The list of supported options follows:
114 <dl compact="compact">
115 <dt> ‘<samp>avioflags <var>flags</var> (<em>input/output</em>)</samp>’</dt>
116 <dd><p>Possible values:
117 </p><dl compact="compact">
118 <dt> ‘<samp>direct</samp>’</dt>
119 <dd><p>Reduce buffering.
124 <dt> ‘<samp>probesize <var>integer</var> (<em>input</em>)</samp>’</dt>
125 <dd><p>Set probing size in bytes, i.e. the size of the data to analyze to get
126 stream information. A higher value will allow to detect more
127 information in case it is dispersed into the stream, but will increase
128 latency. Must be an integer not lesser than 32. It is 5000000 by default.
131 <dt> ‘<samp>packetsize <var>integer</var> (<em>output</em>)</samp>’</dt>
132 <dd><p>Set packet size.
135 <dt> ‘<samp>fflags <var>flags</var> (<em>input/output</em>)</samp>’</dt>
136 <dd><p>Set format flags.
139 </p><dl compact="compact">
140 <dt> ‘<samp>ignidx</samp>’</dt>
143 <dt> ‘<samp>genpts</samp>’</dt>
146 <dt> ‘<samp>nofillin</samp>’</dt>
147 <dd><p>Do not fill in missing values that can be exactly calculated.
149 <dt> ‘<samp>noparse</samp>’</dt>
150 <dd><p>Disable AVParsers, this needs <code>+nofillin</code> too.
152 <dt> ‘<samp>igndts</samp>’</dt>
155 <dt> ‘<samp>discardcorrupt</samp>’</dt>
156 <dd><p>Discard corrupted frames.
158 <dt> ‘<samp>sortdts</samp>’</dt>
159 <dd><p>Try to interleave output packets by DTS.
161 <dt> ‘<samp>keepside</samp>’</dt>
162 <dd><p>Do not merge side data.
164 <dt> ‘<samp>latm</samp>’</dt>
165 <dd><p>Enable RTP MP4A-LATM payload.
167 <dt> ‘<samp>nobuffer</samp>’</dt>
168 <dd><p>Reduce the latency introduced by optional buffering
173 <dt> ‘<samp>seek2any <var>integer</var> (<em>input</em>)</samp>’</dt>
174 <dd><p>Allow seeking to non-keyframes on demuxer level when supported if set to 1.
178 <dt> ‘<samp>analyzeduration <var>integer</var> (<em>input</em>)</samp>’</dt>
179 <dd><p>Specify how many microseconds are analyzed to probe the input. A
180 higher value will allow to detect more accurate information, but will
181 increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
184 <dt> ‘<samp>cryptokey <var>hexadecimal string</var> (<em>input</em>)</samp>’</dt>
185 <dd><p>Set decryption key.
188 <dt> ‘<samp>indexmem <var>integer</var> (<em>input</em>)</samp>’</dt>
189 <dd><p>Set max memory used for timestamp index (per stream).
192 <dt> ‘<samp>rtbufsize <var>integer</var> (<em>input</em>)</samp>’</dt>
193 <dd><p>Set max memory used for buffering real-time frames.
196 <dt> ‘<samp>fdebug <var>flags</var> (<em>input/output</em>)</samp>’</dt>
197 <dd><p>Print specific debug info.
200 </p><dl compact="compact">
201 <dt> ‘<samp>ts</samp>’</dt>
205 <dt> ‘<samp>max_delay <var>integer</var> (<em>input/output</em>)</samp>’</dt>
206 <dd><p>Set maximum muxing or demuxing delay in microseconds.
209 <dt> ‘<samp>fpsprobesize <var>integer</var> (<em>input</em>)</samp>’</dt>
210 <dd><p>Set number of frames used to probe fps.
213 <dt> ‘<samp>audio_preload <var>integer</var> (<em>output</em>)</samp>’</dt>
214 <dd><p>Set microseconds by which audio packets should be interleaved earlier.
217 <dt> ‘<samp>chunk_duration <var>integer</var> (<em>output</em>)</samp>’</dt>
218 <dd><p>Set microseconds for each chunk.
221 <dt> ‘<samp>chunk_size <var>integer</var> (<em>output</em>)</samp>’</dt>
222 <dd><p>Set size in bytes for each chunk.
225 <dt> ‘<samp>err_detect, f_err_detect <var>flags</var> (<em>input</em>)</samp>’</dt>
226 <dd><p>Set error detection flags. <code>f_err_detect</code> is deprecated and
227 should be used only via the <code>ffmpeg</code> tool.
230 </p><dl compact="compact">
231 <dt> ‘<samp>crccheck</samp>’</dt>
232 <dd><p>Verify embedded CRCs.
234 <dt> ‘<samp>bitstream</samp>’</dt>
235 <dd><p>Detect bitstream specification deviations.
237 <dt> ‘<samp>buffer</samp>’</dt>
238 <dd><p>Detect improper bitstream length.
240 <dt> ‘<samp>explode</samp>’</dt>
241 <dd><p>Abort decoding on minor error detection.
243 <dt> ‘<samp>careful</samp>’</dt>
244 <dd><p>Consider things that violate the spec and have not been seen in the
247 <dt> ‘<samp>compliant</samp>’</dt>
248 <dd><p>Consider all spec non compliancies as errors.
250 <dt> ‘<samp>aggressive</samp>’</dt>
251 <dd><p>Consider things that a sane encoder should not do as an error.
256 <dt> ‘<samp>use_wallclock_as_timestamps <var>integer</var> (<em>input</em>)</samp>’</dt>
257 <dd><p>Use wallclock as timestamps.
260 <dt> ‘<samp>avoid_negative_ts <var>integer</var> (<em>output</em>)</samp>’</dt>
261 <dd><p>Shift timestamps to make them non-negative. A value of 1 enables shifting,
262 a value of 0 disables it, the default value of -1 enables shifting
263 when required by the target format.
265 <p>When shifting is enabled, all output timestamps are shifted by the
266 same amount. Audio, video, and subtitles desynching and relative
267 timestamp differences are preserved compared to how they would have
268 been without shifting.
270 <p>Also note that this affects only leading negative timestamps, and not
271 non-monotonic negative timestamps.
274 <dt> ‘<samp>skip_initial_bytes <var>integer</var> (<em>input</em>)</samp>’</dt>
275 <dd><p>Set number of bytes to skip before reading header and frames if set to 1.
279 <dt> ‘<samp>correct_ts_overflow <var>integer</var> (<em>input</em>)</samp>’</dt>
280 <dd><p>Correct single timestamp overflows if set to 1. Default is 1.
283 <dt> ‘<samp>flush_packets <var>integer</var> (<em>output</em>)</samp>’</dt>
284 <dd><p>Flush the underlying I/O stream after each packet. Default 1 enables it, and
285 has the effect of reducing the latency; 0 disables it and may slightly
286 increase performance in some cases.
291 <p><a name="Format-stream-specifiers"></a>
292 </p><a name="Format-stream-specifiers-1"></a>
293 <h2 class="section"><a href="ffmpeg-formats.html#toc-Format-stream-specifiers-1">2.1 Format stream specifiers</a></h2>
295 <p>Format stream specifiers allow selection of one or more streams that
296 match specific properties.
298 <p>Possible forms of stream specifiers are:
299 </p><dl compact="compact">
300 <dt> ‘<samp><var>stream_index</var></samp>’</dt>
301 <dd><p>Matches the stream with this index.
304 <dt> ‘<samp><var>stream_type</var>[:<var>stream_index</var>]</samp>’</dt>
305 <dd><p><var>stream_type</var> is one of following: ’v’ for video, ’a’ for audio,
306 ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. If
307 <var>stream_index</var> is given, then it matches the stream number
308 <var>stream_index</var> of this type. Otherwise, it matches all streams of
312 <dt> ‘<samp>p:<var>program_id</var>[:<var>stream_index</var>]</samp>’</dt>
313 <dd><p>If <var>stream_index</var> is given, then it matches the stream with number
314 <var>stream_index</var> in the program with the id
315 <var>program_id</var>. Otherwise, it matches all streams in the program.
318 <dt> ‘<samp>#<var>stream_id</var></samp>’</dt>
319 <dd><p>Matches the stream by a format-specific ID.
323 <p>The exact semantics of stream specifiers is defined by the
324 <code>avformat_match_stream_specifier()</code> function declared in the
325 ‘<tt>libavformat/avformat.h</tt>’ header.
327 <a name="Demuxers"></a>
328 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Demuxers">3. Demuxers</a></h1>
330 <p>Demuxers are configured elements in FFmpeg that can read the
331 multimedia streams from a particular type of file.
333 <p>When you configure your FFmpeg build, all the supported demuxers
334 are enabled by default. You can list all available ones using the
335 configure option <code>--list-demuxers</code>.
337 <p>You can disable all the demuxers using the configure option
338 <code>--disable-demuxers</code>, and selectively enable a single demuxer with
339 the option <code>--enable-demuxer=<var>DEMUXER</var></code>, or disable it
340 with the option <code>--disable-demuxer=<var>DEMUXER</var></code>.
342 <p>The option <code>-formats</code> of the ff* tools will display the list of
345 <p>The description of some of the currently available demuxers follows.
347 <a name="applehttp"></a>
348 <h2 class="section"><a href="ffmpeg-formats.html#toc-applehttp">3.1 applehttp</a></h2>
350 <p>Apple HTTP Live Streaming demuxer.
352 <p>This demuxer presents all AVStreams from all variant streams.
353 The id field is set to the bitrate variant index number. By setting
354 the discard flags on AVStreams (by pressing ’a’ or ’v’ in ffplay),
355 the caller can decide which variant streams to actually receive.
356 The total bitrate of the variant that the stream belongs to is
357 available in a metadata key named "variant_bitrate".
360 <h2 class="section"><a href="ffmpeg-formats.html#toc-asf">3.2 asf</a></h2>
362 <p>Advanced Systems Format demuxer.
364 <p>This demuxer is used to demux ASF files and MMS network streams.
366 <dl compact="compact">
367 <dt> ‘<samp>-no_resync_search <var>bool</var></samp>’</dt>
368 <dd><p>Do not try to resynchronize by looking for a certain optional start code.
372 <p><a name="concat"></a>
373 </p><a name="concat-1"></a>
374 <h2 class="section"><a href="ffmpeg-formats.html#toc-concat-1">3.3 concat</a></h2>
376 <p>Virtual concatenation script demuxer.
378 <p>This demuxer reads a list of files and other directives from a text file and
379 demuxes them one after the other, as if all their packet had been muxed
382 <p>The timestamps in the files are adjusted so that the first file starts at 0
383 and each next file starts where the previous one finishes. Note that it is
384 done globally and may cause gaps if all streams do not have exactly the same
387 <p>All files must have the same streams (same codecs, same time base, etc.).
389 <p>The duration of each file is used to adjust the timestamps of the next file:
390 if the duration is incorrect (because it was computed using the bit-rate or
391 because the file is truncated, for example), it can cause artifacts. The
392 <code>duration</code> directive can be used to override the duration stored in
395 <a name="Syntax"></a>
396 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Syntax">3.3.1 Syntax</a></h3>
398 <p>The script is a text file in extended-ASCII, with one directive per line.
399 Empty lines, leading spaces and lines starting with ’#’ are ignored. The
400 following directive is recognized:
402 <dl compact="compact">
403 <dt> ‘<samp><code>file <var>path</var></code></samp>’</dt>
404 <dd><p>Path to a file to read; special characters and spaces must be escaped with
405 backslash or single quotes.
407 <p>All subsequent directives apply to that file.
410 <dt> ‘<samp><code>ffconcat version 1.0</code></samp>’</dt>
411 <dd><p>Identify the script type and version. It also sets the ‘<samp>safe</samp>’ option
412 to 1 if it was to its default -1.
414 <p>To make FFmpeg recognize the format automatically, this directive must
415 appears exactly as is (no extra space or byte-order-mark) on the very first
419 <dt> ‘<samp><code>duration <var>dur</var></code></samp>’</dt>
420 <dd><p>Duration of the file. This information can be specified from the file;
421 specifying it here may be more efficient or help if the information from the
422 file is not available or accurate.
424 <p>If the duration is set for all files, then it is possible to seek in the
425 whole concatenated video.
430 <a name="Options"></a>
431 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Options">3.3.2 Options</a></h3>
433 <p>This demuxer accepts the following option:
435 <dl compact="compact">
436 <dt> ‘<samp>safe</samp>’</dt>
437 <dd><p>If set to 1, reject unsafe file paths. A file path is considered safe if it
438 does not contain a protocol specification and is relative and all components
439 only contain characters from the portable character set (letters, digits,
440 period, underscore and hyphen) and have no period at the beginning of a
443 <p>If set to 0, any file name is accepted.
445 <p>The default is -1, it is equivalent to 1 if the format was automatically
446 probed and 0 otherwise.
452 <h2 class="section"><a href="ffmpeg-formats.html#toc-flv">3.4 flv</a></h2>
454 <p>Adobe Flash Video Format demuxer.
456 <p>This demuxer is used to demux FLV files and RTMP network streams.
458 <dl compact="compact">
459 <dt> ‘<samp>-flv_metadata <var>bool</var></samp>’</dt>
460 <dd><p>Allocate the streams according to the onMetaData array content.
464 <a name="libgme"></a>
465 <h2 class="section"><a href="ffmpeg-formats.html#toc-libgme">3.5 libgme</a></h2>
467 <p>The Game Music Emu library is a collection of video game music file emulators.
469 <p>See <a href="http://code.google.com/p/game-music-emu/">http://code.google.com/p/game-music-emu/</a> for more information.
471 <p>Some files have multiple tracks. The demuxer will pick the first track by
472 default. The ‘<samp>track_index</samp>’ option can be used to select a different
473 track. Track indexes start at 0. The demuxer exports the number of tracks as
474 <var>tracks</var> meta data entry.
476 <p>For very large files, the ‘<samp>max_size</samp>’ option may have to be adjusted.
478 <a name="libquvi"></a>
479 <h2 class="section"><a href="ffmpeg-formats.html#toc-libquvi">3.6 libquvi</a></h2>
481 <p>Play media from Internet services using the quvi project.
483 <p>The demuxer accepts a ‘<samp>format</samp>’ option to request a specific quality. It
484 is by default set to <var>best</var>.
486 <p>See <a href="http://quvi.sourceforge.net/">http://quvi.sourceforge.net/</a> for more information.
488 <p>FFmpeg needs to be built with <code>--enable-libquvi</code> for this demuxer to be
491 <a name="image2-2"></a>
492 <h2 class="section"><a href="ffmpeg-formats.html#toc-image2-2">3.7 image2</a></h2>
494 <p>Image file demuxer.
496 <p>This demuxer reads from a list of image files specified by a pattern.
497 The syntax and meaning of the pattern is specified by the
498 option <var>pattern_type</var>.
500 <p>The pattern may contain a suffix which is used to automatically
501 determine the format of the images contained in the files.
503 <p>The size, the pixel format, and the format of each image must be the
504 same for all the files in the sequence.
506 <p>This demuxer accepts the following options:
507 </p><dl compact="compact">
508 <dt> ‘<samp>framerate</samp>’</dt>
509 <dd><p>Set the frame rate for the video stream. It defaults to 25.
511 <dt> ‘<samp>loop</samp>’</dt>
512 <dd><p>If set to 1, loop over the input. Default value is 0.
514 <dt> ‘<samp>pattern_type</samp>’</dt>
515 <dd><p>Select the pattern type used to interpret the provided filename.
517 <p><var>pattern_type</var> accepts one of the following values.
518 </p><dl compact="compact">
519 <dt> ‘<samp>sequence</samp>’</dt>
520 <dd><p>Select a sequence pattern type, used to specify a sequence of files
521 indexed by sequential numbers.
523 <p>A sequence pattern may contain the string "%d" or "%0<var>N</var>d", which
524 specifies the position of the characters representing a sequential
525 number in each filename matched by the pattern. If the form
526 "%d0<var>N</var>d" is used, the string representing the number in each
527 filename is 0-padded and <var>N</var> is the total number of 0-padded
528 digits representing the number. The literal character ’%’ can be
529 specified in the pattern with the string "%%".
531 <p>If the sequence pattern contains "%d" or "%0<var>N</var>d", the first filename of
532 the file list specified by the pattern must contain a number
533 inclusively contained between <var>start_number</var> and
534 <var>start_number</var>+<var>start_number_range</var>-1, and all the following
535 numbers must be sequential.
537 <p>For example the pattern "img-%03d.bmp" will match a sequence of
538 filenames of the form ‘<tt>img-001.bmp</tt>’, ‘<tt>img-002.bmp</tt>’, ...,
539 ‘<tt>img-010.bmp</tt>’, etc.; the pattern "i%%m%%g-%d.jpg" will match a
540 sequence of filenames of the form ‘<tt>i%m%g-1.jpg</tt>’,
541 ‘<tt>i%m%g-2.jpg</tt>’, ..., ‘<tt>i%m%g-10.jpg</tt>’, etc.
543 <p>Note that the pattern must not necessarily contain "%d" or
544 "%0<var>N</var>d", for example to convert a single image file
545 ‘<tt>img.jpeg</tt>’ you can employ the command:
546 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i img.jpeg img.png
547 </pre></td></tr></table>
550 <dt> ‘<samp>glob</samp>’</dt>
551 <dd><p>Select a glob wildcard pattern type.
553 <p>The pattern is interpreted like a <code>glob()</code> pattern. This is only
554 selectable if libavformat was compiled with globbing support.
557 <dt> ‘<samp>glob_sequence <em>(deprecated, will be removed)</em></samp>’</dt>
558 <dd><p>Select a mixed glob wildcard/sequence pattern.
560 <p>If your version of libavformat was compiled with globbing support, and
561 the provided pattern contains at least one glob meta character among
562 <code>%*?[]{}</code> that is preceded by an unescaped "%", the pattern is
563 interpreted like a <code>glob()</code> pattern, otherwise it is interpreted
564 like a sequence pattern.
566 <p>All glob special characters <code>%*?[]{}</code> must be prefixed
567 with "%". To escape a literal "%" you shall use "%%".
569 <p>For example the pattern <code>foo-%*.jpeg</code> will match all the
570 filenames prefixed by "foo-" and terminating with ".jpeg", and
571 <code>foo-%?%?%?.jpeg</code> will match all the filenames prefixed with
572 "foo-", followed by a sequence of three characters, and terminating
573 with ".jpeg".
575 <p>This pattern type is deprecated in favor of <var>glob</var> and
580 <p>Default value is <var>glob_sequence</var>.
582 <dt> ‘<samp>pixel_format</samp>’</dt>
583 <dd><p>Set the pixel format of the images to read. If not specified the pixel
584 format is guessed from the first image file in the sequence.
586 <dt> ‘<samp>start_number</samp>’</dt>
587 <dd><p>Set the index of the file matched by the image file pattern to start
588 to read from. Default value is 0.
590 <dt> ‘<samp>start_number_range</samp>’</dt>
591 <dd><p>Set the index interval range to check when looking for the first image
592 file in the sequence, starting from <var>start_number</var>. Default value
595 <dt> ‘<samp>ts_from_file</samp>’</dt>
596 <dd><p>If set to 1, will set frame timestamp to modification time of image file. Note
597 that monotonity of timestamps is not provided: images go in the same order as
598 without this option. Default value is 0.
600 <dt> ‘<samp>video_size</samp>’</dt>
601 <dd><p>Set the video size of the images to read. If not specified the video
602 size is guessed from the first image file in the sequence.
606 <a name="Examples-1"></a>
607 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Examples-1">3.7.1 Examples</a></h3>
611 Use <code>ffmpeg</code> for creating a video from the images in the file
612 sequence ‘<tt>img-001.jpeg</tt>’, ‘<tt>img-002.jpeg</tt>’, ..., assuming an
613 input frame rate of 10 frames per second:
614 <table><tr><td> </td><td><pre class="example">ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
615 </pre></td></tr></table>
618 As above, but start by reading from a file with index 100 in the sequence:
619 <table><tr><td> </td><td><pre class="example">ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
620 </pre></td></tr></table>
623 Read images matching the "*.png" glob pattern , that is all the files
624 terminating with the ".png" suffix:
625 <table><tr><td> </td><td><pre class="example">ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
626 </pre></td></tr></table>
629 <a name="mpegts-1"></a>
630 <h2 class="section"><a href="ffmpeg-formats.html#toc-mpegts-1">3.8 mpegts</a></h2>
632 <p>MPEG-2 transport stream demuxer.
634 <dl compact="compact">
635 <dt> ‘<samp>fix_teletext_pts</samp>’</dt>
636 <dd><p>Overrides teletext packet PTS and DTS values with the timestamps calculated
637 from the PCR of the first program which the teletext stream is part of and is
638 not discarded. Default value is 1, set this option to 0 if you want your
639 teletext packet PTS and DTS values untouched.
643 <a name="rawvideo"></a>
644 <h2 class="section"><a href="ffmpeg-formats.html#toc-rawvideo">3.9 rawvideo</a></h2>
646 <p>Raw video demuxer.
648 <p>This demuxer allows to read raw video data. Since there is no header
649 specifying the assumed video parameters, the user must specify them
650 in order to be able to decode the data correctly.
652 <p>This demuxer accepts the following options:
653 </p><dl compact="compact">
654 <dt> ‘<samp>framerate</samp>’</dt>
655 <dd><p>Set input video frame rate. Default value is 25.
658 <dt> ‘<samp>pixel_format</samp>’</dt>
659 <dd><p>Set the input video pixel format. Default value is <code>yuv420p</code>.
662 <dt> ‘<samp>video_size</samp>’</dt>
663 <dd><p>Set the input video size. This value must be specified explicitly.
667 <p>For example to read a rawvideo file ‘<tt>input.raw</tt>’ with
668 <code>ffplay</code>, assuming a pixel format of <code>rgb24</code>, a video
669 size of <code>320x240</code>, and a frame rate of 10 images per second, use
671 </p><table><tr><td> </td><td><pre class="example">ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
672 </pre></td></tr></table>
675 <h2 class="section"><a href="ffmpeg-formats.html#toc-sbg">3.10 sbg</a></h2>
677 <p>SBaGen script demuxer.
679 <p>This demuxer reads the script language used by SBaGen
680 <a href="http://uazu.net/sbagen/">http://uazu.net/sbagen/</a> to generate binaural beats sessions. A SBG
681 script looks like that:
682 </p><table><tr><td> </td><td><pre class="example">-SE
683 a: 300-2.5/3 440+4.5/0
684 b: 300-2.5/0 440+4.5/3
691 </pre></td></tr></table>
693 <p>A SBG script can mix absolute and relative timestamps. If the script uses
694 either only absolute timestamps (including the script start time) or only
695 relative ones, then its layout is fixed, and the conversion is
696 straightforward. On the other hand, if the script mixes both kind of
697 timestamps, then the <var>NOW</var> reference for relative timestamps will be
698 taken from the current time of day at the time the script is read, and the
699 script layout will be frozen according to that reference. That means that if
700 the script is directly played, the actual times will match the absolute
701 timestamps up to the sound controller’s clock accuracy, but if the user
702 somehow pauses the playback or seeks, all times will be shifted accordingly.
704 <a name="tedcaptions"></a>
705 <h2 class="section"><a href="ffmpeg-formats.html#toc-tedcaptions">3.11 tedcaptions</a></h2>
707 <p>JSON captions used for <a href="http://www.ted.com/">TED Talks</a>.
709 <p>TED does not provide links to the captions, but they can be guessed from the
710 page. The file ‘<tt>tools/bookmarklets.html</tt>’ from the FFmpeg source tree
711 contains a bookmarklet to expose them.
713 <p>This demuxer accepts the following option:
714 </p><dl compact="compact">
715 <dt> ‘<samp>start_time</samp>’</dt>
716 <dd><p>Set the start time of the TED talk, in milliseconds. The default is 15000
717 (15s). It is used to sync the captions with the downloadable videos, because
718 they include a 15s intro.
722 <p>Example: convert the captions to a format most players understand:
723 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
724 </pre></td></tr></table>
726 <a name="Muxers"></a>
727 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Muxers">4. Muxers</a></h1>
729 <p>Muxers are configured elements in FFmpeg which allow writing
730 multimedia streams to a particular type of file.
732 <p>When you configure your FFmpeg build, all the supported muxers
733 are enabled by default. You can list all available muxers using the
734 configure option <code>--list-muxers</code>.
736 <p>You can disable all the muxers with the configure option
737 <code>--disable-muxers</code> and selectively enable / disable single muxers
738 with the options <code>--enable-muxer=<var>MUXER</var></code> /
739 <code>--disable-muxer=<var>MUXER</var></code>.
741 <p>The option <code>-formats</code> of the ff* tools will display the list of
744 <p>A description of some of the currently available muxers follows.
746 <p><a name="aiff"></a>
747 </p><a name="aiff-1"></a>
748 <h2 class="section"><a href="ffmpeg-formats.html#toc-aiff-1">4.1 aiff</a></h2>
750 <p>Audio Interchange File Format muxer.
752 <p>It accepts the following options:
754 <dl compact="compact">
755 <dt> ‘<samp>write_id3v2</samp>’</dt>
756 <dd><p>Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
759 <dt> ‘<samp>id3v2_version</samp>’</dt>
760 <dd><p>Select ID3v2 version to write. Currently only version 3 and 4 (aka.
761 ID3v2.3 and ID3v2.4) are supported. The default is version 4.
766 <p><a name="crc"></a>
767 </p><a name="crc-1"></a>
768 <h2 class="section"><a href="ffmpeg-formats.html#toc-crc-1">4.2 crc</a></h2>
770 <p>CRC (Cyclic Redundancy Check) testing format.
772 <p>This muxer computes and prints the Adler-32 CRC of all the input audio
773 and video frames. By default audio frames are converted to signed
774 16-bit raw audio and video frames to raw video before computing the
777 <p>The output of the muxer consists of a single line of the form:
778 CRC=0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal number 0-padded to
779 8 digits containing the CRC for all the decoded input frames.
781 <p>For example to compute the CRC of the input, and store it in the file
782 ‘<tt>out.crc</tt>’:
783 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f crc out.crc
784 </pre></td></tr></table>
786 <p>You can print the CRC to stdout with the command:
787 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f crc -
788 </pre></td></tr></table>
790 <p>You can select the output format of each frame with <code>ffmpeg</code> by
791 specifying the audio and video codec and format. For example to
792 compute the CRC of the input audio converted to PCM unsigned 8-bit
793 and the input video converted to MPEG-2 video, use the command:
794 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
795 </pre></td></tr></table>
797 <p>See also the <a href="#framecrc">framecrc</a> muxer.
799 <p><a name="framecrc"></a>
800 </p><a name="framecrc-1"></a>
801 <h2 class="section"><a href="ffmpeg-formats.html#toc-framecrc-1">4.3 framecrc</a></h2>
803 <p>Per-packet CRC (Cyclic Redundancy Check) testing format.
805 <p>This muxer computes and prints the Adler-32 CRC for each audio
806 and video packet. By default audio frames are converted to signed
807 16-bit raw audio and video frames to raw video before computing the
810 <p>The output of the muxer consists of a line for each audio and video
812 </p><table><tr><td> </td><td><pre class="example"><var>stream_index</var>, <var>packet_dts</var>, <var>packet_pts</var>, <var>packet_duration</var>, <var>packet_size</var>, 0x<var>CRC</var>
813 </pre></td></tr></table>
815 <p><var>CRC</var> is a hexadecimal number 0-padded to 8 digits containing the
818 <p>For example to compute the CRC of the audio and video frames in
819 ‘<tt>INPUT</tt>’, converted to raw audio and video packets, and store it
820 in the file ‘<tt>out.crc</tt>’:
821 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f framecrc out.crc
822 </pre></td></tr></table>
824 <p>To print the information to stdout, use the command:
825 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f framecrc -
826 </pre></td></tr></table>
828 <p>With <code>ffmpeg</code>, you can select the output format to which the
829 audio and video frames are encoded before computing the CRC for each
830 packet by specifying the audio and video codec. For example, to
831 compute the CRC of each decoded input audio frame converted to PCM
832 unsigned 8-bit and of each decoded input video frame converted to
833 MPEG-2 video, use the command:
834 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
835 </pre></td></tr></table>
837 <p>See also the <a href="#crc">crc</a> muxer.
839 <p><a name="framemd5"></a>
840 </p><a name="framemd5-1"></a>
841 <h2 class="section"><a href="ffmpeg-formats.html#toc-framemd5-1">4.4 framemd5</a></h2>
843 <p>Per-packet MD5 testing format.
845 <p>This muxer computes and prints the MD5 hash for each audio
846 and video packet. By default audio frames are converted to signed
847 16-bit raw audio and video frames to raw video before computing the
850 <p>The output of the muxer consists of a line for each audio and video
852 </p><table><tr><td> </td><td><pre class="example"><var>stream_index</var>, <var>packet_dts</var>, <var>packet_pts</var>, <var>packet_duration</var>, <var>packet_size</var>, <var>MD5</var>
853 </pre></td></tr></table>
855 <p><var>MD5</var> is a hexadecimal number representing the computed MD5 hash
858 <p>For example to compute the MD5 of the audio and video frames in
859 ‘<tt>INPUT</tt>’, converted to raw audio and video packets, and store it
860 in the file ‘<tt>out.md5</tt>’:
861 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f framemd5 out.md5
862 </pre></td></tr></table>
864 <p>To print the information to stdout, use the command:
865 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f framemd5 -
866 </pre></td></tr></table>
868 <p>See also the <a href="#md5">md5</a> muxer.
870 <p><a name="gif"></a>
871 </p><a name="gif-1"></a>
872 <h2 class="section"><a href="ffmpeg-formats.html#toc-gif-1">4.5 gif</a></h2>
874 <p>Animated GIF muxer.
876 <p>It accepts the following options:
878 <dl compact="compact">
879 <dt> ‘<samp>loop</samp>’</dt>
880 <dd><p>Set the number of times to loop the output. Use <code>-1</code> for no loop, <code>0</code>
881 for looping indefinitely (default).
884 <dt> ‘<samp>final_delay</samp>’</dt>
885 <dd><p>Force the delay (expressed in centiseconds) after the last frame. Each frame
886 ends with a delay until the next frame. The default is <code>-1</code>, which is a
887 special value to tell the muxer to re-use the previous delay. In case of a
888 loop, you might want to customize this value to mark a pause for instance.
892 <p>For example, to encode a gif looping 10 times, with a 5 seconds delay between
894 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
895 </pre></td></tr></table>
897 <p>Note 1: if you wish to extract the frames in separate GIF files, you need to
898 force the <a href="#image2">image2</a> muxer:
899 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -c:v gif -f image2 "out%d.gif"
900 </pre></td></tr></table>
902 <p>Note 2: the GIF format has a very small time base: the delay between two frames
903 can not be smaller than one centi second.
905 <p><a name="hls"></a>
906 </p><a name="hls-1"></a>
907 <h2 class="section"><a href="ffmpeg-formats.html#toc-hls-1">4.6 hls</a></h2>
909 <p>Apple HTTP Live Streaming muxer that segments MPEG-TS according to
910 the HTTP Live Streaming specification.
912 <p>It creates a playlist file and numbered segment files. The output
913 filename specifies the playlist filename; the segment filenames
914 receive the same basename as the playlist, a sequential number and
917 <table><tr><td> </td><td><pre class="example">ffmpeg -i in.nut out.m3u8
918 </pre></td></tr></table>
920 <dl compact="compact">
921 <dt> ‘<samp>-hls_time <var>seconds</var></samp>’</dt>
922 <dd><p>Set the segment length in seconds.
924 <dt> ‘<samp>-hls_list_size <var>size</var></samp>’</dt>
925 <dd><p>Set the maximum number of playlist entries.
927 <dt> ‘<samp>-hls_wrap <var>wrap</var></samp>’</dt>
928 <dd><p>Set the number after which index wraps.
930 <dt> ‘<samp>-start_number <var>number</var></samp>’</dt>
931 <dd><p>Start the sequence from <var>number</var>.
935 <p><a name="ico"></a>
936 </p><a name="ico-1"></a>
937 <h2 class="section"><a href="ffmpeg-formats.html#toc-ico-1">4.7 ico</a></h2>
941 <p>Microsoft’s icon file format (ICO) has some strict limitations that should be noted:
945 Size cannot exceed 256 pixels in any dimension
948 Only BMP and PNG images can be stored
951 If a BMP image is used, it must be one of the following pixel formats:
952 <table><tr><td> </td><td><pre class="example">BMP Bit Depth FFmpeg Pixel Format
959 </pre></td></tr></table>
962 If a BMP image is used, it must use the BITMAPINFOHEADER DIB header
965 If a PNG image is used, it must use the rgba pixel format
968 <p><a name="image2"></a>
969 </p><a name="image2-1"></a>
970 <h2 class="section"><a href="ffmpeg-formats.html#toc-image2-1">4.8 image2</a></h2>
974 <p>The image file muxer writes video frames to image files.
976 <p>The output filenames are specified by a pattern, which can be used to
977 produce sequentially numbered series of files.
978 The pattern may contain the string "%d" or "%0<var>N</var>d", this string
979 specifies the position of the characters representing a numbering in
980 the filenames. If the form "%0<var>N</var>d" is used, the string
981 representing the number in each filename is 0-padded to <var>N</var>
982 digits. The literal character ’%’ can be specified in the pattern with
983 the string "%%".
985 <p>If the pattern contains "%d" or "%0<var>N</var>d", the first filename of
986 the file list specified will contain the number 1, all the following
987 numbers will be sequential.
989 <p>The pattern may contain a suffix which is used to automatically
990 determine the format of the image files to write.
992 <p>For example the pattern "img-%03d.bmp" will specify a sequence of
993 filenames of the form ‘<tt>img-001.bmp</tt>’, ‘<tt>img-002.bmp</tt>’, ...,
994 ‘<tt>img-010.bmp</tt>’, etc.
995 The pattern "img%%-%d.jpg" will specify a sequence of filenames of the
996 form ‘<tt>img%-1.jpg</tt>’, ‘<tt>img%-2.jpg</tt>’, ..., ‘<tt>img%-10.jpg</tt>’,
999 <p>The following example shows how to use <code>ffmpeg</code> for creating a
1000 sequence of files ‘<tt>img-001.jpeg</tt>’, ‘<tt>img-002.jpeg</tt>’, ...,
1001 taking one image every second from the input video:
1002 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg'
1003 </pre></td></tr></table>
1005 <p>Note that with <code>ffmpeg</code>, if the format is not specified with the
1006 <code>-f</code> option and the output filename specifies an image file
1007 format, the image2 muxer is automatically selected, so the previous
1008 command can be written as:
1009 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg'
1010 </pre></td></tr></table>
1012 <p>Note also that the pattern must not necessarily contain "%d" or
1013 "%0<var>N</var>d", for example to create a single image file
1014 ‘<tt>img.jpeg</tt>’ from the input video you can employ the command:
1015 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
1016 </pre></td></tr></table>
1018 <dl compact="compact">
1019 <dt> ‘<samp>start_number <var>number</var></samp>’</dt>
1020 <dd><p>Start the sequence from <var>number</var>. Default value is 1. Must be a
1021 non-negative number.
1024 <dt> ‘<samp>-update <var>number</var></samp>’</dt>
1025 <dd><p>If <var>number</var> is nonzero, the filename will always be interpreted as just a
1026 filename, not a pattern, and this file will be continuously overwritten with new
1032 <p>The image muxer supports the .Y.U.V image file format. This format is
1033 special in that that each image frame consists of three files, for
1034 each of the YUV420P components. To read or write this image file format,
1035 specify the name of the ’.Y’ file. The muxer will automatically open the
1036 ’.U’ and ’.V’ files as required.
1038 <a name="matroska"></a>
1039 <h2 class="section"><a href="ffmpeg-formats.html#toc-matroska">4.9 matroska</a></h2>
1041 <p>Matroska container muxer.
1043 <p>This muxer implements the matroska and webm container specs.
1045 <p>The recognized metadata settings in this muxer are:
1047 <dl compact="compact">
1048 <dt> ‘<samp>title=<var>title name</var></samp>’</dt>
1049 <dd><p>Name provided to a single track
1053 <dl compact="compact">
1054 <dt> ‘<samp>language=<var>language name</var></samp>’</dt>
1055 <dd><p>Specifies the language of the track in the Matroska languages form
1059 <dl compact="compact">
1060 <dt> ‘<samp>stereo_mode=<var>mode</var></samp>’</dt>
1061 <dd><p>Stereo 3D video layout of two views in a single video track
1062 </p><dl compact="compact">
1063 <dt> ‘<samp>mono</samp>’</dt>
1064 <dd><p>video is not stereo
1066 <dt> ‘<samp>left_right</samp>’</dt>
1067 <dd><p>Both views are arranged side by side, Left-eye view is on the left
1069 <dt> ‘<samp>bottom_top</samp>’</dt>
1070 <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is at bottom
1072 <dt> ‘<samp>top_bottom</samp>’</dt>
1073 <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is on top
1075 <dt> ‘<samp>checkerboard_rl</samp>’</dt>
1076 <dd><p>Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
1078 <dt> ‘<samp>checkerboard_lr</samp>’</dt>
1079 <dd><p>Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
1081 <dt> ‘<samp>row_interleaved_rl</samp>’</dt>
1082 <dd><p>Each view is constituted by a row based interleaving, Right-eye view is first row
1084 <dt> ‘<samp>row_interleaved_lr</samp>’</dt>
1085 <dd><p>Each view is constituted by a row based interleaving, Left-eye view is first row
1087 <dt> ‘<samp>col_interleaved_rl</samp>’</dt>
1088 <dd><p>Both views are arranged in a column based interleaving manner, Right-eye view is first column
1090 <dt> ‘<samp>col_interleaved_lr</samp>’</dt>
1091 <dd><p>Both views are arranged in a column based interleaving manner, Left-eye view is first column
1093 <dt> ‘<samp>anaglyph_cyan_red</samp>’</dt>
1094 <dd><p>All frames are in anaglyph format viewable through red-cyan filters
1096 <dt> ‘<samp>right_left</samp>’</dt>
1097 <dd><p>Both views are arranged side by side, Right-eye view is on the left
1099 <dt> ‘<samp>anaglyph_green_magenta</samp>’</dt>
1100 <dd><p>All frames are in anaglyph format viewable through green-magenta filters
1102 <dt> ‘<samp>block_lr</samp>’</dt>
1103 <dd><p>Both eyes laced in one Block, Left-eye view is first
1105 <dt> ‘<samp>block_rl</samp>’</dt>
1106 <dd><p>Both eyes laced in one Block, Right-eye view is first
1112 <p>For example a 3D WebM clip can be created using the following command line:
1113 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
1114 </pre></td></tr></table>
1116 <p>This muxer supports the following options:
1118 <dl compact="compact">
1119 <dt> ‘<samp>reserve_index_space</samp>’</dt>
1120 <dd><p>By default, this muxer writes the index for seeking (called cues in Matroska
1121 terms) at the end of the file, because it cannot know in advance how much space
1122 to leave for the index at the beginning of the file. However for some use cases
1123 – e.g. streaming where seeking is possible but slow – it is useful to put the
1124 index at the beginning of the file.
1126 <p>If this option is set to a non-zero value, the muxer will reserve a given amount
1127 of space in the file header and then try to write the cues there when the muxing
1128 finishes. If the available space does not suffice, muxing will fail. A safe size
1129 for most use cases should be about 50kB per hour of video.
1131 <p>Note that cues are only written if the output is seekable and this option will
1132 have no effect if it is not.
1137 <p><a name="md5"></a>
1138 </p><a name="md5-1"></a>
1139 <h2 class="section"><a href="ffmpeg-formats.html#toc-md5-1">4.10 md5</a></h2>
1141 <p>MD5 testing format.
1143 <p>This muxer computes and prints the MD5 hash of all the input audio
1144 and video frames. By default audio frames are converted to signed
1145 16-bit raw audio and video frames to raw video before computing the
1148 <p>The output of the muxer consists of a single line of the form:
1149 MD5=<var>MD5</var>, where <var>MD5</var> is a hexadecimal number representing
1150 the computed MD5 hash.
1152 <p>For example to compute the MD5 hash of the input converted to raw
1153 audio and video, and store it in the file ‘<tt>out.md5</tt>’:
1154 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f md5 out.md5
1155 </pre></td></tr></table>
1157 <p>You can print the MD5 to stdout with the command:
1158 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f md5 -
1159 </pre></td></tr></table>
1161 <p>See also the <a href="#framemd5">framemd5</a> muxer.
1163 <a name="mov_002fmp4_002fismv"></a>
1164 <h2 class="section"><a href="ffmpeg-formats.html#toc-mov_002fmp4_002fismv">4.11 mov/mp4/ismv</a></h2>
1166 <p>MOV/MP4/ISMV (Smooth Streaming) muxer.
1168 <p>The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4
1169 file has all the metadata about all packets stored in one location
1170 (written at the end of the file, it can be moved to the start for
1171 better playback by adding <var>faststart</var> to the <var>movflags</var>, or
1172 using the <code>qt-faststart</code> tool). A fragmented
1173 file consists of a number of fragments, where packets and metadata
1174 about these packets are stored together. Writing a fragmented
1175 file has the advantage that the file is decodable even if the
1176 writing is interrupted (while a normal MOV/MP4 is undecodable if
1177 it is not properly finished), and it requires less memory when writing
1178 very long files (since writing normal MOV/MP4 files stores info about
1179 every single packet in memory until the file is closed). The downside
1180 is that it is less compatible with other applications.
1182 <p>Fragmentation is enabled by setting one of the AVOptions that define
1183 how to cut the file into fragments:
1185 <dl compact="compact">
1186 <dt> ‘<samp>-moov_size <var>bytes</var></samp>’</dt>
1187 <dd><p>Reserves space for the moov atom at the beginning of the file instead of placing the
1188 moov atom at the end. If the space reserved is insufficient, muxing will fail.
1190 <dt> ‘<samp>-movflags frag_keyframe</samp>’</dt>
1191 <dd><p>Start a new fragment at each video keyframe.
1193 <dt> ‘<samp>-frag_duration <var>duration</var></samp>’</dt>
1194 <dd><p>Create fragments that are <var>duration</var> microseconds long.
1196 <dt> ‘<samp>-frag_size <var>size</var></samp>’</dt>
1197 <dd><p>Create fragments that contain up to <var>size</var> bytes of payload data.
1199 <dt> ‘<samp>-movflags frag_custom</samp>’</dt>
1200 <dd><p>Allow the caller to manually choose when to cut fragments, by
1201 calling <code>av_write_frame(ctx, NULL)</code> to write a fragment with
1202 the packets written so far. (This is only useful with other
1203 applications integrating libavformat, not from <code>ffmpeg</code>.)
1205 <dt> ‘<samp>-min_frag_duration <var>duration</var></samp>’</dt>
1206 <dd><p>Don’t create fragments that are shorter than <var>duration</var> microseconds long.
1210 <p>If more than one condition is specified, fragments are cut when
1211 one of the specified conditions is fulfilled. The exception to this is
1212 <code>-min_frag_duration</code>, which has to be fulfilled for any of the other
1213 conditions to apply.
1215 <p>Additionally, the way the output file is written can be adjusted
1216 through a few other options:
1218 <dl compact="compact">
1219 <dt> ‘<samp>-movflags empty_moov</samp>’</dt>
1220 <dd><p>Write an initial moov atom directly at the start of the file, without
1221 describing any samples in it. Generally, an mdat/moov pair is written
1222 at the start of the file, as a normal MOV/MP4 file, containing only
1223 a short portion of the file. With this option set, there is no initial
1224 mdat atom, and the moov atom only describes the tracks but has
1227 <p>Files written with this option set do not work in QuickTime.
1228 This option is implicitly set when writing ismv (Smooth Streaming) files.
1230 <dt> ‘<samp>-movflags separate_moof</samp>’</dt>
1231 <dd><p>Write a separate moof (movie fragment) atom for each track. Normally,
1232 packets for all tracks are written in a moof atom (which is slightly
1233 more efficient), but with this option set, the muxer writes one moof/mdat
1234 pair for each track, making it easier to separate tracks.
1236 <p>This option is implicitly set when writing ismv (Smooth Streaming) files.
1238 <dt> ‘<samp>-movflags faststart</samp>’</dt>
1239 <dd><p>Run a second pass moving the index (moov atom) to the beginning of the file.
1240 This operation can take a while, and will not work in various situations such
1241 as fragmented output, thus it is not enabled by default.
1243 <dt> ‘<samp>-movflags rtphint</samp>’</dt>
1244 <dd><p>Add RTP hinting tracks to the output file.
1248 <p>Smooth Streaming content can be pushed in real time to a publishing
1249 point on IIS with this muxer. Example:
1250 </p><table><tr><td> </td><td><pre class="example">ffmpeg -re <var><normal input/transcoding options></var> -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
1251 </pre></td></tr></table>
1254 <h2 class="section"><a href="ffmpeg-formats.html#toc-mp3">4.12 mp3</a></h2>
1256 <p>The MP3 muxer writes a raw MP3 stream with an ID3v2 header at the beginning and
1257 optionally an ID3v1 tag at the end. ID3v2.3 and ID3v2.4 are supported, the
1258 <code>id3v2_version</code> option controls which one is used. The legacy ID3v1 tag is
1259 not written by default, but may be enabled with the <code>write_id3v1</code> option.
1261 <p>For seekable output the muxer also writes a Xing frame at the beginning, which
1262 contains the number of frames in the file. It is useful for computing duration
1265 <p>The muxer supports writing ID3v2 attached pictures (APIC frames). The pictures
1266 are supplied to the muxer in form of a video stream with a single packet. There
1267 can be any number of those streams, each will correspond to a single APIC frame.
1268 The stream metadata tags <var>title</var> and <var>comment</var> map to APIC
1269 <var>description</var> and <var>picture type</var> respectively. See
1270 <a href="http://id3.org/id3v2.4.0-frames">http://id3.org/id3v2.4.0-frames</a> for allowed picture types.
1272 <p>Note that the APIC frames must be written at the beginning, so the muxer will
1273 buffer the audio frames until it gets all the pictures. It is therefore advised
1274 to provide the pictures as soon as possible to avoid excessive buffering.
1278 <p>Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
1279 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
1280 </pre></td></tr></table>
1282 <p>To attach a picture to an mp3 file select both the audio and the picture stream
1283 with <code>map</code>:
1284 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1
1285 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3
1286 </pre></td></tr></table>
1288 <a name="mpegts"></a>
1289 <h2 class="section"><a href="ffmpeg-formats.html#toc-mpegts">4.13 mpegts</a></h2>
1291 <p>MPEG transport stream muxer.
1293 <p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
1295 <p>The muxer options are:
1297 <dl compact="compact">
1298 <dt> ‘<samp>-mpegts_original_network_id <var>number</var></samp>’</dt>
1299 <dd><p>Set the original_network_id (default 0x0001). This is unique identifier
1300 of a network in DVB. Its main use is in the unique identification of a
1301 service through the path Original_Network_ID, Transport_Stream_ID.
1303 <dt> ‘<samp>-mpegts_transport_stream_id <var>number</var></samp>’</dt>
1304 <dd><p>Set the transport_stream_id (default 0x0001). This identifies a
1307 <dt> ‘<samp>-mpegts_service_id <var>number</var></samp>’</dt>
1308 <dd><p>Set the service_id (default 0x0001) also known as program in DVB.
1310 <dt> ‘<samp>-mpegts_pmt_start_pid <var>number</var></samp>’</dt>
1311 <dd><p>Set the first PID for PMT (default 0x1000, max 0x1f00).
1313 <dt> ‘<samp>-mpegts_start_pid <var>number</var></samp>’</dt>
1314 <dd><p>Set the first PID for data packets (default 0x0100, max 0x0f00).
1316 <dt> ‘<samp>-mpegts_m2ts_mode <var>number</var></samp>’</dt>
1317 <dd><p>Enable m2ts mode if set to 1. Default value is -1 which disables m2ts mode.
1319 <dt> ‘<samp>-muxrate <var>number</var></samp>’</dt>
1322 <dt> ‘<samp>-pes_payload_size <var>number</var></samp>’</dt>
1323 <dd><p>Set minimum PES packet payload in bytes.
1325 <dt> ‘<samp>-mpegts_flags <var>flags</var></samp>’</dt>
1326 <dd><p>Set flags (see below).
1328 <dt> ‘<samp>-mpegts_copyts <var>number</var></samp>’</dt>
1329 <dd><p>Preserve original timestamps, if value is set to 1. Default value is -1, which
1330 results in shifting timestamps so that they start from 0.
1332 <dt> ‘<samp>-tables_version <var>number</var></samp>’</dt>
1333 <dd><p>Set PAT, PMT and SDT version (default 0, valid values are from 0 to 31, inclusively).
1334 This option allows updating stream structure so that standard consumer may
1335 detect the change. To do so, reopen output AVFormatContext (in case of API
1336 usage) or restart ffmpeg instance, cyclically changing tables_version value:
1337 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i source1.ts -codec copy -f mpegts -tables_version 0 udp://1.1.1.1:1111
1338 ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
1340 ffmpeg -i source3.ts -codec copy -f mpegts -tables_version 31 udp://1.1.1.1:1111
1341 ffmpeg -i source1.ts -codec copy -f mpegts -tables_version 0 udp://1.1.1.1:1111
1342 ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
1344 </pre></td></tr></table>
1348 <p>Option mpegts_flags may take a set of such flags:
1350 <dl compact="compact">
1351 <dt> ‘<samp>resend_headers</samp>’</dt>
1352 <dd><p>Reemit PAT/PMT before writing the next packet.
1354 <dt> ‘<samp>latm</samp>’</dt>
1355 <dd><p>Use LATM packetization for AAC.
1359 <p>The recognized metadata settings in mpegts muxer are <code>service_provider</code>
1360 and <code>service_name</code>. If they are not set the default for
1361 <code>service_provider</code> is "FFmpeg" and the default for
1362 <code>service_name</code> is "Service01".
1364 <table><tr><td> </td><td><pre class="example">ffmpeg -i file.mpg -c copy \
1365 -mpegts_original_network_id 0x1122 \
1366 -mpegts_transport_stream_id 0x3344 \
1367 -mpegts_service_id 0x5566 \
1368 -mpegts_pmt_start_pid 0x1500 \
1369 -mpegts_start_pid 0x150 \
1370 -metadata service_provider="Some provider" \
1371 -metadata service_name="Some Channel" \
1373 </pre></td></tr></table>
1376 <h2 class="section"><a href="ffmpeg-formats.html#toc-null">4.14 null</a></h2>
1380 <p>This muxer does not generate any output file, it is mainly useful for
1381 testing or benchmarking purposes.
1383 <p>For example to benchmark decoding with <code>ffmpeg</code> you can use the
1385 </p><table><tr><td> </td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
1386 </pre></td></tr></table>
1388 <p>Note that the above command does not read or write the ‘<tt>out.null</tt>’
1389 file, but specifying the output file is required by the <code>ffmpeg</code>
1392 <p>Alternatively you can write the command as:
1393 </p><table><tr><td> </td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null -
1394 </pre></td></tr></table>
1397 <h2 class="section"><a href="ffmpeg-formats.html#toc-ogg">4.15 ogg</a></h2>
1399 <p>Ogg container muxer.
1401 <dl compact="compact">
1402 <dt> ‘<samp>-page_duration <var>duration</var></samp>’</dt>
1403 <dd><p>Preferred page duration, in microseconds. The muxer will attempt to create
1404 pages that are approximately <var>duration</var> microseconds long. This allows the
1405 user to compromise between seek granularity and container overhead. The default
1406 is 1 second. A value of 0 will fill all segments, making pages as large as
1407 possible. A value of 1 will effectively use 1 packet-per-page in most
1408 situations, giving a small seek granularity at the cost of additional container
1413 <a name="segment_002c-stream_005fsegment_002c-ssegment"></a>
1414 <h2 class="section"><a href="ffmpeg-formats.html#toc-segment_002c-stream_005fsegment_002c-ssegment">4.16 segment, stream_segment, ssegment</a></h2>
1416 <p>Basic stream segmenter.
1418 <p>The segmenter muxer outputs streams to a number of separate files of nearly
1419 fixed duration. Output filename pattern can be set in a fashion similar to
1420 <a href="#image2">image2</a>.
1422 <p><code>stream_segment</code> is a variant of the muxer used to write to
1423 streaming output formats, i.e. which do not require global headers,
1424 and is recommended for outputting e.g. to MPEG transport stream segments.
1425 <code>ssegment</code> is a shorter alias for <code>stream_segment</code>.
1427 <p>Every segment starts with a keyframe of the selected reference stream,
1428 which is set through the ‘<samp>reference_stream</samp>’ option.
1430 <p>Note that if you want accurate splitting for a video file, you need to
1431 make the input key frames correspond to the exact splitting times
1432 expected by the segmenter, or the segment muxer will start the new
1433 segment with the key frame found next after the specified start
1436 <p>The segment muxer works best with a single constant frame rate video.
1438 <p>Optionally it can generate a list of the created segments, by setting
1439 the option <var>segment_list</var>. The list type is specified by the
1440 <var>segment_list_type</var> option. The entry filenames in the segment
1441 list are set by default to the basename of the corresponding segment
1444 <p>The segment muxer supports the following options:
1446 <dl compact="compact">
1447 <dt> ‘<samp>reference_stream <var>specifier</var></samp>’</dt>
1448 <dd><p>Set the reference stream, as specified by the string <var>specifier</var>.
1449 If <var>specifier</var> is set to <code>auto</code>, the reference is choosen
1450 automatically. Otherwise it must be a stream specifier (see the “Stream
1451 specifiers” chapter in the ffmpeg manual) which specifies the
1452 reference stream. The default value is <code>auto</code>.
1455 <dt> ‘<samp>segment_format <var>format</var></samp>’</dt>
1456 <dd><p>Override the inner container format, by default it is guessed by the filename
1460 <dt> ‘<samp>segment_list <var>name</var></samp>’</dt>
1461 <dd><p>Generate also a listfile named <var>name</var>. If not specified no
1462 listfile is generated.
1465 <dt> ‘<samp>segment_list_flags <var>flags</var></samp>’</dt>
1466 <dd><p>Set flags affecting the segment list generation.
1468 <p>It currently supports the following flags:
1469 </p><dl compact="compact">
1470 <dt> ‘<samp>cache</samp>’</dt>
1471 <dd><p>Allow caching (only affects M3U8 list files).
1474 <dt> ‘<samp>live</samp>’</dt>
1475 <dd><p>Allow live-friendly file generation.
1480 <dt> ‘<samp>segment_list_size <var>size</var></samp>’</dt>
1481 <dd><p>Update the list file so that it contains at most the last <var>size</var>
1482 segments. If 0 the list file will contain all the segments. Default
1486 <dt> ‘<samp>segment_list_entry_prefix <var>prefix</var></samp>’</dt>
1487 <dd><p>Set <var>prefix</var> to prepend to the name of each entry filename. By
1488 default no prefix is applied.
1491 <dt> ‘<samp>segment_list_type <var>type</var></samp>’</dt>
1492 <dd><p>Specify the format for the segment list file.
1494 <p>The following values are recognized:
1495 </p><dl compact="compact">
1496 <dt> ‘<samp>flat</samp>’</dt>
1497 <dd><p>Generate a flat list for the created segments, one segment per line.
1500 <dt> ‘<samp>csv, ext</samp>’</dt>
1501 <dd><p>Generate a list for the created segments, one segment per line,
1502 each line matching the format (comma-separated values):
1503 </p><table><tr><td> </td><td><pre class="example"><var>segment_filename</var>,<var>segment_start_time</var>,<var>segment_end_time</var>
1504 </pre></td></tr></table>
1506 <p><var>segment_filename</var> is the name of the output file generated by the
1507 muxer according to the provided pattern. CSV escaping (according to
1508 RFC4180) is applied if required.
1510 <p><var>segment_start_time</var> and <var>segment_end_time</var> specify
1511 the segment start and end time expressed in seconds.
1513 <p>A list file with the suffix <code>".csv"</code> or <code>".ext"</code> will
1514 auto-select this format.
1516 <p>‘<samp>ext</samp>’ is deprecated in favor or ‘<samp>csv</samp>’.
1519 <dt> ‘<samp>ffconcat</samp>’</dt>
1520 <dd><p>Generate an ffconcat file for the created segments. The resulting file
1521 can be read using the FFmpeg <a href="#concat">concat</a> demuxer.
1523 <p>A list file with the suffix <code>".ffcat"</code> or <code>".ffconcat"</code> will
1524 auto-select this format.
1527 <dt> ‘<samp>m3u8</samp>’</dt>
1528 <dd><p>Generate an extended M3U8 file, version 3, compliant with
1529 <a href="http://tools.ietf.org/id/draft-pantos-http-live-streaming">http://tools.ietf.org/id/draft-pantos-http-live-streaming</a>.
1531 <p>A list file with the suffix <code>".m3u8"</code> will auto-select this format.
1535 <p>If not specified the type is guessed from the list file name suffix.
1538 <dt> ‘<samp>segment_time <var>time</var></samp>’</dt>
1539 <dd><p>Set segment duration to <var>time</var>, the value must be a duration
1540 specification. Default value is "2". See also the
1541 ‘<samp>segment_times</samp>’ option.
1543 <p>Note that splitting may not be accurate, unless you force the
1544 reference stream key-frames at the given time. See the introductory
1545 notice and the examples below.
1548 <dt> ‘<samp>segment_time_delta <var>delta</var></samp>’</dt>
1549 <dd><p>Specify the accuracy time when selecting the start time for a
1550 segment, expressed as a duration specification. Default value is "0".
1552 <p>When delta is specified a key-frame will start a new segment if its
1553 PTS satisfies the relation:
1554 </p><table><tr><td> </td><td><pre class="example">PTS >= start_time - time_delta
1555 </pre></td></tr></table>
1557 <p>This option is useful when splitting video content, which is always
1558 split at GOP boundaries, in case a key frame is found just before the
1559 specified split time.
1561 <p>In particular may be used in combination with the ‘<tt>ffmpeg</tt>’ option
1562 <var>force_key_frames</var>. The key frame times specified by
1563 <var>force_key_frames</var> may not be set accurately because of rounding
1564 issues, with the consequence that a key frame time may result set just
1565 before the specified time. For constant frame rate videos a value of
1566 1/2*<var>frame_rate</var> should address the worst case mismatch between
1567 the specified time and the time set by <var>force_key_frames</var>.
1570 <dt> ‘<samp>segment_times <var>times</var></samp>’</dt>
1571 <dd><p>Specify a list of split points. <var>times</var> contains a list of comma
1572 separated duration specifications, in increasing order. See also
1573 the ‘<samp>segment_time</samp>’ option.
1576 <dt> ‘<samp>segment_frames <var>frames</var></samp>’</dt>
1577 <dd><p>Specify a list of split video frame numbers. <var>frames</var> contains a
1578 list of comma separated integer numbers, in increasing order.
1580 <p>This option specifies to start a new segment whenever a reference
1581 stream key frame is found and the sequential number (starting from 0)
1582 of the frame is greater or equal to the next value in the list.
1585 <dt> ‘<samp>segment_wrap <var>limit</var></samp>’</dt>
1586 <dd><p>Wrap around segment index once it reaches <var>limit</var>.
1589 <dt> ‘<samp>segment_start_number <var>number</var></samp>’</dt>
1590 <dd><p>Set the sequence number of the first segment. Defaults to <code>0</code>.
1593 <dt> ‘<samp>reset_timestamps <var>1|0</var></samp>’</dt>
1594 <dd><p>Reset timestamps at the begin of each segment, so that each segment
1595 will start with near-zero timestamps. It is meant to ease the playback
1596 of the generated segments. May not work with some combinations of
1597 muxers/codecs. It is set to <code>0</code> by default.
1600 <dt> ‘<samp>initial_offset <var>offset</var></samp>’</dt>
1601 <dd><p>Specify timestamp offset to apply to the output packet timestamps. The
1602 argument must be a time duration specification, and defaults to 0.
1606 <a name="Examples"></a>
1607 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Examples">4.16.1 Examples</a></h3>
1611 To remux the content of file ‘<tt>in.mkv</tt>’ to a list of segments
1612 ‘<tt>out-000.nut</tt>’, ‘<tt>out-001.nut</tt>’, etc., and write the list of
1613 generated segments to ‘<tt>out.list</tt>’:
1614 <table><tr><td> </td><td><pre class="example">ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.list out%03d.nut
1615 </pre></td></tr></table>
1618 As the example above, but segment the input file according to the split
1619 points specified by the <var>segment_times</var> option:
1620 <table><tr><td> </td><td><pre class="example">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
1621 </pre></td></tr></table>
1624 As the example above, but use the <code>ffmpeg</code> ‘<samp>force_key_frames</samp>’
1625 option to force key frames in the input at the specified location, together
1626 with the segment option ‘<samp>segment_time_delta</samp>’ to account for
1627 possible roundings operated when setting key frame times.
1628 <table><tr><td> </td><td><pre class="example">ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -codec:v mpeg4 -codec:a pcm_s16le -map 0 \
1629 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
1630 </pre></td></tr></table>
1631 <p>In order to force key frames on the input file, transcoding is
1635 Segment the input file by splitting the input file according to the
1636 frame numbers sequence specified with the ‘<samp>segment_frames</samp>’ option:
1637 <table><tr><td> </td><td><pre class="example">ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_frames 100,200,300,500,800 out%03d.nut
1638 </pre></td></tr></table>
1641 To convert the ‘<tt>in.mkv</tt>’ to TS segments using the <code>libx264</code>
1642 and <code>libfaac</code> encoders:
1643 <table><tr><td> </td><td><pre class="example">ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a libfaac -f ssegment -segment_list out.list out%03d.ts
1644 </pre></td></tr></table>
1647 Segment the input file, and create an M3U8 live playlist (can be used
1648 as live HLS source):
1649 <table><tr><td> </td><td><pre class="example">ffmpeg -re -i in.mkv -codec copy -map 0 -f segment -segment_list playlist.m3u8 \
1650 -segment_list_flags +live -segment_time 10 out%03d.mkv
1651 </pre></td></tr></table>
1655 <h2 class="section"><a href="ffmpeg-formats.html#toc-tee">4.17 tee</a></h2>
1657 <p>The tee muxer can be used to write the same data to several files or any
1658 other kind of muxer. It can be used, for example, to both stream a video to
1659 the network and save it to disk at the same time.
1661 <p>It is different from specifying several outputs to the <code>ffmpeg</code>
1662 command-line tool because the audio and video data will be encoded only once
1663 with the tee muxer; encoding can be a very expensive process. It is not
1664 useful when using the libavformat API directly because it is then possible
1665 to feed the same packets to several muxers directly.
1667 <p>The slave outputs are specified in the file name given to the muxer,
1668 separated by ’|’. If any of the slave name contains the ’|’ separator,
1669 leading or trailing spaces or any special character, it must be
1670 escaped (see the “Quoting and escaping” section in the ffmpeg-utils
1673 <p>Muxer options can be specified for each slave by prepending them as a list of
1674 <var>key</var>=<var>value</var> pairs separated by ’:’, between square brackets. If
1675 the options values contain a special character or the ’:’ separator, they
1676 must be escaped; note that this is a second level escaping.
1678 <p>The following special options are also recognized:
1679 </p><dl compact="compact">
1680 <dt> ‘<samp>f</samp>’</dt>
1681 <dd><p>Specify the format name. Useful if it cannot be guessed from the
1685 <dt> ‘<samp>bsfs[/<var>spec</var>]</samp>’</dt>
1686 <dd><p>Specify a list of bitstream filters to apply to the specified
1687 output. It is possible to specify to which streams a given bitstream
1688 filter applies, by appending a stream specifier to the option
1689 separated by <code>/</code>. If the stream specifier is not specified, the
1690 bistream filters will be applied to all streams in the output.
1692 <p>Several bitstream filters can be specified, separated by ",".
1695 <dt> ‘<samp>select</samp>’</dt>
1696 <dd><p>Select the streams that should be mapped to the slave output,
1697 specified by a stream specifier. If not specified, this defaults to
1698 all the input streams.
1702 <p>Some examples follow.
1705 Encode something and both archive it in a WebM file and stream it
1706 as MPEG-TS over UDP (the streams need to be explicitly mapped):
1707 <table><tr><td> </td><td><pre class="example">ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
1708 "archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
1709 </pre></td></tr></table>
1712 Use <code>ffmpeg</code> to encode the input, and send the output
1713 to three different destinations. The <code>dump_extra</code> bitstream
1714 filter is used to add extradata information to all the output video
1715 keyframes packets, as requested by the MPEG-TS format. The select
1716 option is applied to ‘<tt>out.aac</tt>’ in order to make it contain only
1718 <table><tr><td> </td><td><pre class="example">ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac -strict experimental
1719 -f tee "[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"
1720 </pre></td></tr></table>
1723 <p>Note: some codecs may need different options depending on the output format;
1724 the auto-detection of this can not work with the tee muxer. The main example
1725 is the ‘<samp>global_header</samp>’ flag.
1727 <a name="Metadata"></a>
1728 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Metadata">5. Metadata</a></h1>
1730 <p>FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
1731 INI-like text file and then load it back using the metadata muxer/demuxer.
1733 <p>The file format is as follows:
1736 A file consists of a header and a number of metadata tags divided into sections,
1737 each on its own line.
1740 The header is a ’;FFMETADATA’ string, followed by a version number (now 1).
1743 Metadata tags are of the form ’key=value’
1746 Immediately after header follows global metadata
1749 After global metadata there may be sections with per-stream/per-chapter
1753 A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
1754 brackets (’[’, ’]’) and ends with next section or end of file.
1757 At the beginning of a chapter section there may be an optional timebase to be
1758 used for start/end values. It must be in form ’TIMEBASE=num/den’, where num and
1759 den are integers. If the timebase is missing then start/end times are assumed to
1761 Next a chapter section must contain chapter start and end times in form
1762 ’START=num’, ’END=num’, where num is a positive integer.
1765 Empty lines and lines starting with ’;’ or ’#’ are ignored.
1768 Metadata keys or values containing special characters (’=’, ’;’, ’#’, ’\’ and a
1769 newline) must be escaped with a backslash ’\’.
1772 Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
1773 the tag (in the example above key is ’foo ’, value is ’ bar’).
1776 <p>A ffmetadata file might look like this:
1777 </p><table><tr><td> </td><td><pre class="example">;FFMETADATA1
1780 artist=FFmpeg troll team
1785 #chapter ends at 0:01:00
1791 </pre></td></tr></table>
1793 <p>By using the ffmetadata muxer and demuxer it is possible to extract
1794 metadata from an input file to an ffmetadata file, and then transcode
1795 the file into an output file with the edited ffmetadata file.
1797 <p>Extracting an ffmetadata file with ‘<tt>ffmpeg</tt>’ goes as follows:
1798 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
1799 </pre></td></tr></table>
1801 <p>Reinserting edited metadata information from the FFMETADATAFILE file can
1803 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
1804 </pre></td></tr></table>
1807 <a name="See-Also"></a>
1808 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-See-Also">6. See Also</a></h1>
1810 <p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>, <a href="ffserver.html">ffserver</a>,
1811 <a href="libavformat.html">libavformat</a>
1814 <a name="Authors"></a>
1815 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Authors">7. Authors</a></h1>
1817 <p>The FFmpeg developers.
1819 <p>For details about the authorship, see the Git history of the project
1820 (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
1821 <code>git log</code> in the FFmpeg source directory, or browsing the
1822 online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>.
1824 <p>Maintainers for the specific components are listed in the file
1825 ‘<tt>MAINTAINERS</tt>’ in the source code tree.
1828 <footer class="footer pagination-right">
1829 <span class="label label-info">This document was generated by <em>Kyle Schwarz</em> on <em>December 14, 2013</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.</span></footer></div></div></body>