]> git.sesse.net Git - casparcg/blob - dependencies/ffmpeg/doc/ffmpeg-formats.html
Check in complete ffmpeg-20131215-git-ec13849-win32 Zeranoe build with README updates...
[casparcg] / dependencies / ffmpeg / doc / ffmpeg-formats.html
1 <!DOCTYPE html>
2 <html>
3 <!-- Created on December 14, 2013 by texi2html 1.82 -->
4 <!--
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>
9             and many others.
10 Maintained by: Many creative people.
11 Send bugs and suggestions to <texi2html-bug@nongnu.org>
12
13 -->
14 <head>
15 <title>FFmpeg documentation : FFmpeg Formats </title>
16
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" />
22
23 <link rel="icon" href="favicon.png" type="image/png" />
24 </head>
25 <body>
26 <div id="container">
27 <div id="body">
28
29 <a name="SEC_Top"></a>
30 <h1 class="settitle">FFmpeg Formats Documentation</h1>
31
32 <a name="SEC_Contents"></a>
33 <h1>Table of Contents</h1>
34 <div class="contents">
35
36 <ul class="toc">
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>
39   <ul class="toc">
40     <li><a name="toc-Format-stream-specifiers-1" href="#Format-stream-specifiers-1">2.1 Format stream specifiers</a></li>
41   </ul></li>
42   <li><a name="toc-Demuxers" href="#Demuxers">3. Demuxers</a>
43   <ul class="toc">
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>
47     <ul class="toc">
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>
50     </ul></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>
55     <ul class="toc">
56       <li><a name="toc-Examples-1" href="#Examples-1">3.7.1 Examples</a></li>
57     </ul></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>
62   </ul></li>
63   <li><a name="toc-Muxers" href="#Muxers">4. Muxers</a>
64   <ul class="toc">
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>
81     <ul class="toc">
82       <li><a name="toc-Examples" href="#Examples">4.16.1 Examples</a></li>
83     </ul></li>
84     <li><a name="toc-tee" href="#tee">4.17 tee</a></li>
85   </ul></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>
89 </ul>
90 </div>
91
92 <a name="Description"></a>
93 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Description">1. Description</a></h1>
94
95 <p>This document describes the supported formats (muxers and demuxers)
96 provided by the libavformat library.
97 </p>
98
99 <a name="Format-Options"></a>
100 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Format-Options">2. Format Options</a></h1>
101
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
105 that component.
106 </p>
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 &lsquo;<tt>libavutil/opt.h</tt>&rsquo; API
110 for programmatic use.
111 </p>
112 <p>The list of supported options follows:
113 </p>
114 <dl compact="compact">
115 <dt> &lsquo;<samp>avioflags <var>flags</var> (<em>input/output</em>)</samp>&rsquo;</dt>
116 <dd><p>Possible values:
117 </p><dl compact="compact">
118 <dt> &lsquo;<samp>direct</samp>&rsquo;</dt>
119 <dd><p>Reduce buffering.
120 </p></dd>
121 </dl>
122
123 </dd>
124 <dt> &lsquo;<samp>probesize <var>integer</var> (<em>input</em>)</samp>&rsquo;</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.
129 </p>
130 </dd>
131 <dt> &lsquo;<samp>packetsize <var>integer</var> (<em>output</em>)</samp>&rsquo;</dt>
132 <dd><p>Set packet size.
133 </p>
134 </dd>
135 <dt> &lsquo;<samp>fflags <var>flags</var> (<em>input/output</em>)</samp>&rsquo;</dt>
136 <dd><p>Set format flags.
137 </p>
138 <p>Possible values:
139 </p><dl compact="compact">
140 <dt> &lsquo;<samp>ignidx</samp>&rsquo;</dt>
141 <dd><p>Ignore index.
142 </p></dd>
143 <dt> &lsquo;<samp>genpts</samp>&rsquo;</dt>
144 <dd><p>Generate PTS.
145 </p></dd>
146 <dt> &lsquo;<samp>nofillin</samp>&rsquo;</dt>
147 <dd><p>Do not fill in missing values that can be exactly calculated.
148 </p></dd>
149 <dt> &lsquo;<samp>noparse</samp>&rsquo;</dt>
150 <dd><p>Disable AVParsers, this needs <code>+nofillin</code> too.
151 </p></dd>
152 <dt> &lsquo;<samp>igndts</samp>&rsquo;</dt>
153 <dd><p>Ignore DTS.
154 </p></dd>
155 <dt> &lsquo;<samp>discardcorrupt</samp>&rsquo;</dt>
156 <dd><p>Discard corrupted frames.
157 </p></dd>
158 <dt> &lsquo;<samp>sortdts</samp>&rsquo;</dt>
159 <dd><p>Try to interleave output packets by DTS.
160 </p></dd>
161 <dt> &lsquo;<samp>keepside</samp>&rsquo;</dt>
162 <dd><p>Do not merge side data.
163 </p></dd>
164 <dt> &lsquo;<samp>latm</samp>&rsquo;</dt>
165 <dd><p>Enable RTP MP4A-LATM payload.
166 </p></dd>
167 <dt> &lsquo;<samp>nobuffer</samp>&rsquo;</dt>
168 <dd><p>Reduce the latency introduced by optional buffering
169 </p></dd>
170 </dl>
171
172 </dd>
173 <dt> &lsquo;<samp>seek2any <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
174 <dd><p>Allow seeking to non-keyframes on demuxer level when supported if set to 1.
175 Default is 0.
176 </p>
177 </dd>
178 <dt> &lsquo;<samp>analyzeduration <var>integer</var> (<em>input</em>)</samp>&rsquo;</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.
182 </p>
183 </dd>
184 <dt> &lsquo;<samp>cryptokey <var>hexadecimal string</var> (<em>input</em>)</samp>&rsquo;</dt>
185 <dd><p>Set decryption key.
186 </p>
187 </dd>
188 <dt> &lsquo;<samp>indexmem <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
189 <dd><p>Set max memory used for timestamp index (per stream).
190 </p>
191 </dd>
192 <dt> &lsquo;<samp>rtbufsize <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
193 <dd><p>Set max memory used for buffering real-time frames.
194 </p>
195 </dd>
196 <dt> &lsquo;<samp>fdebug <var>flags</var> (<em>input/output</em>)</samp>&rsquo;</dt>
197 <dd><p>Print specific debug info.
198 </p>
199 <p>Possible values:
200 </p><dl compact="compact">
201 <dt> &lsquo;<samp>ts</samp>&rsquo;</dt>
202 </dl>
203
204 </dd>
205 <dt> &lsquo;<samp>max_delay <var>integer</var> (<em>input/output</em>)</samp>&rsquo;</dt>
206 <dd><p>Set maximum muxing or demuxing delay in microseconds.
207 </p>
208 </dd>
209 <dt> &lsquo;<samp>fpsprobesize <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
210 <dd><p>Set number of frames used to probe fps.
211 </p>
212 </dd>
213 <dt> &lsquo;<samp>audio_preload <var>integer</var> (<em>output</em>)</samp>&rsquo;</dt>
214 <dd><p>Set microseconds by which audio packets should be interleaved earlier.
215 </p>
216 </dd>
217 <dt> &lsquo;<samp>chunk_duration <var>integer</var> (<em>output</em>)</samp>&rsquo;</dt>
218 <dd><p>Set microseconds for each chunk.
219 </p>
220 </dd>
221 <dt> &lsquo;<samp>chunk_size <var>integer</var> (<em>output</em>)</samp>&rsquo;</dt>
222 <dd><p>Set size in bytes for each chunk.
223 </p>
224 </dd>
225 <dt> &lsquo;<samp>err_detect, f_err_detect <var>flags</var> (<em>input</em>)</samp>&rsquo;</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.
228 </p>
229 <p>Possible values:
230 </p><dl compact="compact">
231 <dt> &lsquo;<samp>crccheck</samp>&rsquo;</dt>
232 <dd><p>Verify embedded CRCs.
233 </p></dd>
234 <dt> &lsquo;<samp>bitstream</samp>&rsquo;</dt>
235 <dd><p>Detect bitstream specification deviations.
236 </p></dd>
237 <dt> &lsquo;<samp>buffer</samp>&rsquo;</dt>
238 <dd><p>Detect improper bitstream length.
239 </p></dd>
240 <dt> &lsquo;<samp>explode</samp>&rsquo;</dt>
241 <dd><p>Abort decoding on minor error detection.
242 </p></dd>
243 <dt> &lsquo;<samp>careful</samp>&rsquo;</dt>
244 <dd><p>Consider things that violate the spec and have not been seen in the
245 wild as errors.
246 </p></dd>
247 <dt> &lsquo;<samp>compliant</samp>&rsquo;</dt>
248 <dd><p>Consider all spec non compliancies as errors.
249 </p></dd>
250 <dt> &lsquo;<samp>aggressive</samp>&rsquo;</dt>
251 <dd><p>Consider things that a sane encoder should not do as an error.
252 </p></dd>
253 </dl>
254
255 </dd>
256 <dt> &lsquo;<samp>use_wallclock_as_timestamps <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
257 <dd><p>Use wallclock as timestamps.
258 </p>
259 </dd>
260 <dt> &lsquo;<samp>avoid_negative_ts <var>integer</var> (<em>output</em>)</samp>&rsquo;</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.
264 </p>
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.
269 </p>
270 <p>Also note that this affects only leading negative timestamps, and not
271 non-monotonic negative timestamps.
272 </p>
273 </dd>
274 <dt> &lsquo;<samp>skip_initial_bytes <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
275 <dd><p>Set number of bytes to skip before reading header and frames if set to 1.
276 Default is 0.
277 </p>
278 </dd>
279 <dt> &lsquo;<samp>correct_ts_overflow <var>integer</var> (<em>input</em>)</samp>&rsquo;</dt>
280 <dd><p>Correct single timestamp overflows if set to 1. Default is 1.
281 </p>
282 </dd>
283 <dt> &lsquo;<samp>flush_packets <var>integer</var> (<em>output</em>)</samp>&rsquo;</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.
287 </p></dd>
288 </dl>
289
290
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>
294
295 <p>Format stream specifiers allow selection of one or more streams that
296 match specific properties.
297 </p>
298 <p>Possible forms of stream specifiers are:
299 </p><dl compact="compact">
300 <dt> &lsquo;<samp><var>stream_index</var></samp>&rsquo;</dt>
301 <dd><p>Matches the stream with this index.
302 </p>
303 </dd>
304 <dt> &lsquo;<samp><var>stream_type</var>[:<var>stream_index</var>]</samp>&rsquo;</dt>
305 <dd><p><var>stream_type</var> is one of following: &rsquo;v&rsquo; for video, &rsquo;a&rsquo; for audio,
306 &rsquo;s&rsquo; for subtitle, &rsquo;d&rsquo; for data, and &rsquo;t&rsquo; 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
309 this type.
310 </p>
311 </dd>
312 <dt> &lsquo;<samp>p:<var>program_id</var>[:<var>stream_index</var>]</samp>&rsquo;</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.
316 </p>
317 </dd>
318 <dt> &lsquo;<samp>#<var>stream_id</var></samp>&rsquo;</dt>
319 <dd><p>Matches the stream by a format-specific ID.
320 </p></dd>
321 </dl>
322
323 <p>The exact semantics of stream specifiers is defined by the
324 <code>avformat_match_stream_specifier()</code> function declared in the
325 &lsquo;<tt>libavformat/avformat.h</tt>&rsquo; header.
326 </p>
327 <a name="Demuxers"></a>
328 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Demuxers">3. Demuxers</a></h1>
329
330 <p>Demuxers are configured elements in FFmpeg that can read the
331 multimedia streams from a particular type of file.
332 </p>
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>.
336 </p>
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>.
341 </p>
342 <p>The option <code>-formats</code> of the ff* tools will display the list of
343 enabled demuxers.
344 </p>
345 <p>The description of some of the currently available demuxers follows.
346 </p>
347 <a name="applehttp"></a>
348 <h2 class="section"><a href="ffmpeg-formats.html#toc-applehttp">3.1 applehttp</a></h2>
349
350 <p>Apple HTTP Live Streaming demuxer.
351 </p>
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 &rsquo;a&rsquo; or &rsquo;v&rsquo; 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 &quot;variant_bitrate&quot;.
358 </p>
359 <a name="asf"></a>
360 <h2 class="section"><a href="ffmpeg-formats.html#toc-asf">3.2 asf</a></h2>
361
362 <p>Advanced Systems Format demuxer.
363 </p>
364 <p>This demuxer is used to demux ASF files and MMS network streams.
365 </p>
366 <dl compact="compact">
367 <dt> &lsquo;<samp>-no_resync_search <var>bool</var></samp>&rsquo;</dt>
368 <dd><p>Do not try to resynchronize by looking for a certain optional start code.
369 </p></dd>
370 </dl>
371
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>
375
376 <p>Virtual concatenation script demuxer.
377 </p>
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
380 together.
381 </p>
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
385 length.
386 </p>
387 <p>All files must have the same streams (same codecs, same time base, etc.).
388 </p>
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
393 each file.
394 </p>
395 <a name="Syntax"></a>
396 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Syntax">3.3.1 Syntax</a></h3>
397
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 &rsquo;#&rsquo; are ignored. The
400 following directive is recognized:
401 </p>
402 <dl compact="compact">
403 <dt> &lsquo;<samp><code>file <var>path</var></code></samp>&rsquo;</dt>
404 <dd><p>Path to a file to read; special characters and spaces must be escaped with
405 backslash or single quotes.
406 </p>
407 <p>All subsequent directives apply to that file.
408 </p>
409 </dd>
410 <dt> &lsquo;<samp><code>ffconcat version 1.0</code></samp>&rsquo;</dt>
411 <dd><p>Identify the script type and version. It also sets the &lsquo;<samp>safe</samp>&rsquo; option
412 to 1 if it was to its default -1.
413 </p>
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
416 line of the script.
417 </p>
418 </dd>
419 <dt> &lsquo;<samp><code>duration <var>dur</var></code></samp>&rsquo;</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.
423 </p>
424 <p>If the duration is set for all files, then it is possible to seek in the
425 whole concatenated video.
426 </p>
427 </dd>
428 </dl>
429
430 <a name="Options"></a>
431 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Options">3.3.2 Options</a></h3>
432
433 <p>This demuxer accepts the following option:
434 </p>
435 <dl compact="compact">
436 <dt> &lsquo;<samp>safe</samp>&rsquo;</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
441 component.
442 </p>
443 <p>If set to 0, any file name is accepted.
444 </p>
445 <p>The default is -1, it is equivalent to 1 if the format was automatically
446 probed and 0 otherwise.
447 </p>
448 </dd>
449 </dl>
450
451 <a name="flv"></a>
452 <h2 class="section"><a href="ffmpeg-formats.html#toc-flv">3.4 flv</a></h2>
453
454 <p>Adobe Flash Video Format demuxer.
455 </p>
456 <p>This demuxer is used to demux FLV files and RTMP network streams.
457 </p>
458 <dl compact="compact">
459 <dt> &lsquo;<samp>-flv_metadata <var>bool</var></samp>&rsquo;</dt>
460 <dd><p>Allocate the streams according to the onMetaData array content.
461 </p></dd>
462 </dl>
463
464 <a name="libgme"></a>
465 <h2 class="section"><a href="ffmpeg-formats.html#toc-libgme">3.5 libgme</a></h2>
466
467 <p>The Game Music Emu library is a collection of video game music file emulators.
468 </p>
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.
470 </p>
471 <p>Some files have multiple tracks. The demuxer will pick the first track by
472 default. The &lsquo;<samp>track_index</samp>&rsquo; 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.
475 </p>
476 <p>For very large files, the &lsquo;<samp>max_size</samp>&rsquo; option may have to be adjusted.
477 </p>
478 <a name="libquvi"></a>
479 <h2 class="section"><a href="ffmpeg-formats.html#toc-libquvi">3.6 libquvi</a></h2>
480
481 <p>Play media from Internet services using the quvi project.
482 </p>
483 <p>The demuxer accepts a &lsquo;<samp>format</samp>&rsquo; option to request a specific quality. It
484 is by default set to <var>best</var>.
485 </p>
486 <p>See <a href="http://quvi.sourceforge.net/">http://quvi.sourceforge.net/</a> for more information.
487 </p>
488 <p>FFmpeg needs to be built with <code>--enable-libquvi</code> for this demuxer to be
489 enabled.
490 </p>
491 <a name="image2-2"></a>
492 <h2 class="section"><a href="ffmpeg-formats.html#toc-image2-2">3.7 image2</a></h2>
493
494 <p>Image file demuxer.
495 </p>
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>.
499 </p>
500 <p>The pattern may contain a suffix which is used to automatically
501 determine the format of the images contained in the files.
502 </p>
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.
505 </p>
506 <p>This demuxer accepts the following options:
507 </p><dl compact="compact">
508 <dt> &lsquo;<samp>framerate</samp>&rsquo;</dt>
509 <dd><p>Set the frame rate for the video stream. It defaults to 25.
510 </p></dd>
511 <dt> &lsquo;<samp>loop</samp>&rsquo;</dt>
512 <dd><p>If set to 1, loop over the input. Default value is 0.
513 </p></dd>
514 <dt> &lsquo;<samp>pattern_type</samp>&rsquo;</dt>
515 <dd><p>Select the pattern type used to interpret the provided filename.
516 </p>
517 <p><var>pattern_type</var> accepts one of the following values.
518 </p><dl compact="compact">
519 <dt> &lsquo;<samp>sequence</samp>&rsquo;</dt>
520 <dd><p>Select a sequence pattern type, used to specify a sequence of files
521 indexed by sequential numbers.
522 </p>
523 <p>A sequence pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, which
524 specifies the position of the characters representing a sequential
525 number in each filename matched by the pattern. If the form
526 &quot;%d0<var>N</var>d&quot; 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 &rsquo;%&rsquo; can be
529 specified in the pattern with the string &quot;%%&quot;.
530 </p>
531 <p>If the sequence pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, 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.
536 </p>
537 <p>For example the pattern &quot;img-%03d.bmp&quot; will match a sequence of
538 filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
539 &lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.; the pattern &quot;i%%m%%g-%d.jpg&quot; will match a
540 sequence of filenames of the form &lsquo;<tt>i%m%g-1.jpg</tt>&rsquo;,
541 &lsquo;<tt>i%m%g-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>i%m%g-10.jpg</tt>&rsquo;, etc.
542 </p>
543 <p>Note that the pattern must not necessarily contain &quot;%d&quot; or
544 &quot;%0<var>N</var>d&quot;, for example to convert a single image file
545 &lsquo;<tt>img.jpeg</tt>&rsquo; you can employ the command:
546 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i img.jpeg img.png
547 </pre></td></tr></table>
548
549 </dd>
550 <dt> &lsquo;<samp>glob</samp>&rsquo;</dt>
551 <dd><p>Select a glob wildcard pattern type.
552 </p>
553 <p>The pattern is interpreted like a <code>glob()</code> pattern. This is only
554 selectable if libavformat was compiled with globbing support.
555 </p>
556 </dd>
557 <dt> &lsquo;<samp>glob_sequence <em>(deprecated, will be removed)</em></samp>&rsquo;</dt>
558 <dd><p>Select a mixed glob wildcard/sequence pattern.
559 </p>
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 &quot;%&quot;, the pattern is
563 interpreted like a <code>glob()</code> pattern, otherwise it is interpreted
564 like a sequence pattern.
565 </p>
566 <p>All glob special characters <code>%*?[]{}</code> must be prefixed
567 with &quot;%&quot;. To escape a literal &quot;%&quot; you shall use &quot;%%&quot;.
568 </p>
569 <p>For example the pattern <code>foo-%*.jpeg</code> will match all the
570 filenames prefixed by &quot;foo-&quot; and terminating with &quot;.jpeg&quot;, and
571 <code>foo-%?%?%?.jpeg</code> will match all the filenames prefixed with
572 &quot;foo-&quot;, followed by a sequence of three characters, and terminating
573 with &quot;.jpeg&quot;.
574 </p>
575 <p>This pattern type is deprecated in favor of <var>glob</var> and
576 <var>sequence</var>.
577 </p></dd>
578 </dl>
579
580 <p>Default value is <var>glob_sequence</var>.
581 </p></dd>
582 <dt> &lsquo;<samp>pixel_format</samp>&rsquo;</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.
585 </p></dd>
586 <dt> &lsquo;<samp>start_number</samp>&rsquo;</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.
589 </p></dd>
590 <dt> &lsquo;<samp>start_number_range</samp>&rsquo;</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
593 is 5.
594 </p></dd>
595 <dt> &lsquo;<samp>ts_from_file</samp>&rsquo;</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.
599 </p></dd>
600 <dt> &lsquo;<samp>video_size</samp>&rsquo;</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.
603 </p></dd>
604 </dl>
605
606 <a name="Examples-1"></a>
607 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Examples-1">3.7.1 Examples</a></h3>
608
609 <ul>
610 <li>
611 Use <code>ffmpeg</code> for creating a video from the images in the file
612 sequence &lsquo;<tt>img-001.jpeg</tt>&rsquo;, &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ..., assuming an
613 input frame rate of 10 frames per second:
614 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
615 </pre></td></tr></table>
616
617 </li><li>
618 As above, but start by reading from a file with index 100 in the sequence:
619 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
620 </pre></td></tr></table>
621
622 </li><li>
623 Read images matching the &quot;*.png&quot; glob pattern , that is all the files
624 terminating with the &quot;.png&quot; suffix:
625 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -framerate 10 -pattern_type glob -i &quot;*.png&quot; out.mkv
626 </pre></td></tr></table>
627 </li></ul>
628
629 <a name="mpegts-1"></a>
630 <h2 class="section"><a href="ffmpeg-formats.html#toc-mpegts-1">3.8 mpegts</a></h2>
631
632 <p>MPEG-2 transport stream demuxer.
633 </p>
634 <dl compact="compact">
635 <dt> &lsquo;<samp>fix_teletext_pts</samp>&rsquo;</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.
640 </p></dd>
641 </dl>
642
643 <a name="rawvideo"></a>
644 <h2 class="section"><a href="ffmpeg-formats.html#toc-rawvideo">3.9 rawvideo</a></h2>
645
646 <p>Raw video demuxer.
647 </p>
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.
651 </p>
652 <p>This demuxer accepts the following options:
653 </p><dl compact="compact">
654 <dt> &lsquo;<samp>framerate</samp>&rsquo;</dt>
655 <dd><p>Set input video frame rate. Default value is 25.
656 </p>
657 </dd>
658 <dt> &lsquo;<samp>pixel_format</samp>&rsquo;</dt>
659 <dd><p>Set the input video pixel format. Default value is <code>yuv420p</code>.
660 </p>
661 </dd>
662 <dt> &lsquo;<samp>video_size</samp>&rsquo;</dt>
663 <dd><p>Set the input video size. This value must be specified explicitly.
664 </p></dd>
665 </dl>
666
667 <p>For example to read a rawvideo file &lsquo;<tt>input.raw</tt>&rsquo; 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
670 the command:
671 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
672 </pre></td></tr></table>
673
674 <a name="sbg"></a>
675 <h2 class="section"><a href="ffmpeg-formats.html#toc-sbg">3.10 sbg</a></h2>
676
677 <p>SBaGen script demuxer.
678 </p>
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>&nbsp;</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
685 off: -
686 NOW      == a
687 +0:07:00 == b
688 +0:14:00 == a
689 +0:21:00 == b
690 +0:30:00    off
691 </pre></td></tr></table>
692
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&rsquo;s clock accuracy, but if the user
702 somehow pauses the playback or seeks, all times will be shifted accordingly.
703 </p>
704 <a name="tedcaptions"></a>
705 <h2 class="section"><a href="ffmpeg-formats.html#toc-tedcaptions">3.11 tedcaptions</a></h2>
706
707 <p>JSON captions used for <a href="http://www.ted.com/">TED Talks</a>.
708 </p>
709 <p>TED does not provide links to the captions, but they can be guessed from the
710 page. The file &lsquo;<tt>tools/bookmarklets.html</tt>&rsquo; from the FFmpeg source tree
711 contains a bookmarklet to expose them.
712 </p>
713 <p>This demuxer accepts the following option:
714 </p><dl compact="compact">
715 <dt> &lsquo;<samp>start_time</samp>&rsquo;</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.
719 </p></dd>
720 </dl>
721
722 <p>Example: convert the captions to a format most players understand:
723 </p><table><tr><td>&nbsp;</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>
725
726 <a name="Muxers"></a>
727 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Muxers">4. Muxers</a></h1>
728
729 <p>Muxers are configured elements in FFmpeg which allow writing
730 multimedia streams to a particular type of file.
731 </p>
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>.
735 </p>
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>.
740 </p>
741 <p>The option <code>-formats</code> of the ff* tools will display the list of
742 enabled muxers.
743 </p>
744 <p>A description of some of the currently available muxers follows.
745 </p>
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>
749
750 <p>Audio Interchange File Format muxer.
751 </p>
752 <p>It accepts the following options:
753 </p>
754 <dl compact="compact">
755 <dt> &lsquo;<samp>write_id3v2</samp>&rsquo;</dt>
756 <dd><p>Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
757 </p>
758 </dd>
759 <dt> &lsquo;<samp>id3v2_version</samp>&rsquo;</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.
762 </p>
763 </dd>
764 </dl>
765
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>
769
770 <p>CRC (Cyclic Redundancy Check) testing format.
771 </p>
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
775 CRC.
776 </p>
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.
780 </p>
781 <p>For example to compute the CRC of the input, and store it in the file
782 &lsquo;<tt>out.crc</tt>&rsquo;:
783 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc out.crc
784 </pre></td></tr></table>
785
786 <p>You can print the CRC to stdout with the command:
787 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc -
788 </pre></td></tr></table>
789
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>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
795 </pre></td></tr></table>
796
797 <p>See also the <a href="#framecrc">framecrc</a> muxer.
798 </p>
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>
802
803 <p>Per-packet CRC (Cyclic Redundancy Check) testing format.
804 </p>
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
808 CRC.
809 </p>
810 <p>The output of the muxer consists of a line for each audio and video
811 packet of the form:
812 </p><table><tr><td>&nbsp;</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>
814
815 <p><var>CRC</var> is a hexadecimal number 0-padded to 8 digits containing the
816 CRC of the packet.
817 </p>
818 <p>For example to compute the CRC of the audio and video frames in
819 &lsquo;<tt>INPUT</tt>&rsquo;, converted to raw audio and video packets, and store it
820 in the file &lsquo;<tt>out.crc</tt>&rsquo;:
821 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc out.crc
822 </pre></td></tr></table>
823
824 <p>To print the information to stdout, use the command:
825 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc -
826 </pre></td></tr></table>
827
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>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
835 </pre></td></tr></table>
836
837 <p>See also the <a href="#crc">crc</a> muxer.
838 </p>
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>
842
843 <p>Per-packet MD5 testing format.
844 </p>
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
848 hash.
849 </p>
850 <p>The output of the muxer consists of a line for each audio and video
851 packet of the form:
852 </p><table><tr><td>&nbsp;</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>
854
855 <p><var>MD5</var> is a hexadecimal number representing the computed MD5 hash
856 for the packet.
857 </p>
858 <p>For example to compute the MD5 of the audio and video frames in
859 &lsquo;<tt>INPUT</tt>&rsquo;, converted to raw audio and video packets, and store it
860 in the file &lsquo;<tt>out.md5</tt>&rsquo;:
861 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framemd5 out.md5
862 </pre></td></tr></table>
863
864 <p>To print the information to stdout, use the command:
865 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framemd5 -
866 </pre></td></tr></table>
867
868 <p>See also the <a href="#md5">md5</a> muxer.
869 </p>
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>
873
874 <p>Animated GIF muxer.
875 </p>
876 <p>It accepts the following options:
877 </p>
878 <dl compact="compact">
879 <dt> &lsquo;<samp>loop</samp>&rsquo;</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).
882 </p>
883 </dd>
884 <dt> &lsquo;<samp>final_delay</samp>&rsquo;</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.
889 </p></dd>
890 </dl>
891
892 <p>For example, to encode a gif looping 10 times, with a 5 seconds delay between
893 the loops:
894 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
895 </pre></td></tr></table>
896
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>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -c:v gif -f image2 &quot;out%d.gif&quot;
900 </pre></td></tr></table>
901
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.
904 </p>
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>
908
909 <p>Apple HTTP Live Streaming muxer that segments MPEG-TS according to
910 the HTTP Live Streaming specification.
911 </p>
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
915 a .ts extension.
916 </p>
917 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.nut out.m3u8
918 </pre></td></tr></table>
919
920 <dl compact="compact">
921 <dt> &lsquo;<samp>-hls_time <var>seconds</var></samp>&rsquo;</dt>
922 <dd><p>Set the segment length in seconds.
923 </p></dd>
924 <dt> &lsquo;<samp>-hls_list_size <var>size</var></samp>&rsquo;</dt>
925 <dd><p>Set the maximum number of playlist entries.
926 </p></dd>
927 <dt> &lsquo;<samp>-hls_wrap <var>wrap</var></samp>&rsquo;</dt>
928 <dd><p>Set the number after which index wraps.
929 </p></dd>
930 <dt> &lsquo;<samp>-start_number <var>number</var></samp>&rsquo;</dt>
931 <dd><p>Start the sequence from <var>number</var>.
932 </p></dd>
933 </dl>
934
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>
938
939 <p>ICO file muxer.
940 </p>
941 <p>Microsoft&rsquo;s icon file format (ICO) has some strict limitations that should be noted:
942 </p>
943 <ul>
944 <li>
945 Size cannot exceed 256 pixels in any dimension
946
947 </li><li>
948 Only BMP and PNG images can be stored
949
950 </li><li>
951 If a BMP image is used, it must be one of the following pixel formats:
952 <table><tr><td>&nbsp;</td><td><pre class="example">BMP Bit Depth      FFmpeg Pixel Format
953 1bit               pal8
954 4bit               pal8
955 8bit               pal8
956 16bit              rgb555le
957 24bit              bgr24
958 32bit              bgra
959 </pre></td></tr></table>
960
961 </li><li>
962 If a BMP image is used, it must use the BITMAPINFOHEADER DIB header
963
964 </li><li>
965 If a PNG image is used, it must use the rgba pixel format
966 </li></ul>
967
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>
971
972 <p>Image file muxer.
973 </p>
974 <p>The image file muxer writes video frames to image files.
975 </p>
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 &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, this string
979 specifies the position of the characters representing a numbering in
980 the filenames. If the form &quot;%0<var>N</var>d&quot; is used, the string
981 representing the number in each filename is 0-padded to <var>N</var>
982 digits. The literal character &rsquo;%&rsquo; can be specified in the pattern with
983 the string &quot;%%&quot;.
984 </p>
985 <p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
986 the file list specified will contain the number 1, all the following
987 numbers will be sequential.
988 </p>
989 <p>The pattern may contain a suffix which is used to automatically
990 determine the format of the image files to write.
991 </p>
992 <p>For example the pattern &quot;img-%03d.bmp&quot; will specify a sequence of
993 filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
994 &lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.
995 The pattern &quot;img%%-%d.jpg&quot; will specify a sequence of filenames of the
996 form &lsquo;<tt>img%-1.jpg</tt>&rsquo;, &lsquo;<tt>img%-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>img%-10.jpg</tt>&rsquo;,
997 etc.
998 </p>
999 <p>The following example shows how to use <code>ffmpeg</code> for creating a
1000 sequence of files &lsquo;<tt>img-001.jpeg</tt>&rsquo;, &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ...,
1001 taking one image every second from the input video:
1002 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg'
1003 </pre></td></tr></table>
1004
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>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg'
1010 </pre></td></tr></table>
1011
1012 <p>Note also that the pattern must not necessarily contain &quot;%d&quot; or
1013 &quot;%0<var>N</var>d&quot;, for example to create a single image file
1014 &lsquo;<tt>img.jpeg</tt>&rsquo; from the input video you can employ the command:
1015 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
1016 </pre></td></tr></table>
1017
1018 <dl compact="compact">
1019 <dt> &lsquo;<samp>start_number <var>number</var></samp>&rsquo;</dt>
1020 <dd><p>Start the sequence from <var>number</var>. Default value is 1. Must be a
1021 non-negative number.
1022 </p>
1023 </dd>
1024 <dt> &lsquo;<samp>-update <var>number</var></samp>&rsquo;</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
1027 images.
1028 </p>
1029 </dd>
1030 </dl>
1031
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 &rsquo;.Y&rsquo; file. The muxer will automatically open the
1036 &rsquo;.U&rsquo; and &rsquo;.V&rsquo; files as required.
1037 </p>
1038 <a name="matroska"></a>
1039 <h2 class="section"><a href="ffmpeg-formats.html#toc-matroska">4.9 matroska</a></h2>
1040
1041 <p>Matroska container muxer.
1042 </p>
1043 <p>This muxer implements the matroska and webm container specs.
1044 </p>
1045 <p>The recognized metadata settings in this muxer are:
1046 </p>
1047 <dl compact="compact">
1048 <dt> &lsquo;<samp>title=<var>title name</var></samp>&rsquo;</dt>
1049 <dd><p>Name provided to a single track
1050 </p></dd>
1051 </dl>
1052
1053 <dl compact="compact">
1054 <dt> &lsquo;<samp>language=<var>language name</var></samp>&rsquo;</dt>
1055 <dd><p>Specifies the language of the track in the Matroska languages form
1056 </p></dd>
1057 </dl>
1058
1059 <dl compact="compact">
1060 <dt> &lsquo;<samp>stereo_mode=<var>mode</var></samp>&rsquo;</dt>
1061 <dd><p>Stereo 3D video layout of two views in a single video track
1062 </p><dl compact="compact">
1063 <dt> &lsquo;<samp>mono</samp>&rsquo;</dt>
1064 <dd><p>video is not stereo
1065 </p></dd>
1066 <dt> &lsquo;<samp>left_right</samp>&rsquo;</dt>
1067 <dd><p>Both views are arranged side by side, Left-eye view is on the left
1068 </p></dd>
1069 <dt> &lsquo;<samp>bottom_top</samp>&rsquo;</dt>
1070 <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is at bottom
1071 </p></dd>
1072 <dt> &lsquo;<samp>top_bottom</samp>&rsquo;</dt>
1073 <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is on top
1074 </p></dd>
1075 <dt> &lsquo;<samp>checkerboard_rl</samp>&rsquo;</dt>
1076 <dd><p>Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
1077 </p></dd>
1078 <dt> &lsquo;<samp>checkerboard_lr</samp>&rsquo;</dt>
1079 <dd><p>Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
1080 </p></dd>
1081 <dt> &lsquo;<samp>row_interleaved_rl</samp>&rsquo;</dt>
1082 <dd><p>Each view is constituted by a row based interleaving, Right-eye view is first row
1083 </p></dd>
1084 <dt> &lsquo;<samp>row_interleaved_lr</samp>&rsquo;</dt>
1085 <dd><p>Each view is constituted by a row based interleaving, Left-eye view is first row
1086 </p></dd>
1087 <dt> &lsquo;<samp>col_interleaved_rl</samp>&rsquo;</dt>
1088 <dd><p>Both views are arranged in a column based interleaving manner, Right-eye view is first column
1089 </p></dd>
1090 <dt> &lsquo;<samp>col_interleaved_lr</samp>&rsquo;</dt>
1091 <dd><p>Both views are arranged in a column based interleaving manner, Left-eye view is first column
1092 </p></dd>
1093 <dt> &lsquo;<samp>anaglyph_cyan_red</samp>&rsquo;</dt>
1094 <dd><p>All frames are in anaglyph format viewable through red-cyan filters
1095 </p></dd>
1096 <dt> &lsquo;<samp>right_left</samp>&rsquo;</dt>
1097 <dd><p>Both views are arranged side by side, Right-eye view is on the left
1098 </p></dd>
1099 <dt> &lsquo;<samp>anaglyph_green_magenta</samp>&rsquo;</dt>
1100 <dd><p>All frames are in anaglyph format viewable through green-magenta filters
1101 </p></dd>
1102 <dt> &lsquo;<samp>block_lr</samp>&rsquo;</dt>
1103 <dd><p>Both eyes laced in one Block, Left-eye view is first
1104 </p></dd>
1105 <dt> &lsquo;<samp>block_rl</samp>&rsquo;</dt>
1106 <dd><p>Both eyes laced in one Block, Right-eye view is first
1107 </p></dd>
1108 </dl>
1109 </dd>
1110 </dl>
1111
1112 <p>For example a 3D WebM clip can be created using the following command line:
1113 </p><table><tr><td>&nbsp;</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>
1115
1116 <p>This muxer supports the following options:
1117 </p>
1118 <dl compact="compact">
1119 <dt> &lsquo;<samp>reserve_index_space</samp>&rsquo;</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 &ndash; e.g.  streaming where seeking is possible but slow &ndash; it is useful to put the
1124 index at the beginning of the file.
1125 </p>
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.
1130 </p>
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.
1133 </p>
1134 </dd>
1135 </dl>
1136
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>
1140
1141 <p>MD5 testing format.
1142 </p>
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
1146 hash.
1147 </p>
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.
1151 </p>
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 &lsquo;<tt>out.md5</tt>&rsquo;:
1154 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f md5 out.md5
1155 </pre></td></tr></table>
1156
1157 <p>You can print the MD5 to stdout with the command:
1158 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f md5 -
1159 </pre></td></tr></table>
1160
1161 <p>See also the <a href="#framemd5">framemd5</a> muxer.
1162 </p>
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>
1165
1166 <p>MOV/MP4/ISMV (Smooth Streaming) muxer.
1167 </p>
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.
1181 </p>
1182 <p>Fragmentation is enabled by setting one of the AVOptions that define
1183 how to cut the file into fragments:
1184 </p>
1185 <dl compact="compact">
1186 <dt> &lsquo;<samp>-moov_size <var>bytes</var></samp>&rsquo;</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.
1189 </p></dd>
1190 <dt> &lsquo;<samp>-movflags frag_keyframe</samp>&rsquo;</dt>
1191 <dd><p>Start a new fragment at each video keyframe.
1192 </p></dd>
1193 <dt> &lsquo;<samp>-frag_duration <var>duration</var></samp>&rsquo;</dt>
1194 <dd><p>Create fragments that are <var>duration</var> microseconds long.
1195 </p></dd>
1196 <dt> &lsquo;<samp>-frag_size <var>size</var></samp>&rsquo;</dt>
1197 <dd><p>Create fragments that contain up to <var>size</var> bytes of payload data.
1198 </p></dd>
1199 <dt> &lsquo;<samp>-movflags frag_custom</samp>&rsquo;</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>.)
1204 </p></dd>
1205 <dt> &lsquo;<samp>-min_frag_duration <var>duration</var></samp>&rsquo;</dt>
1206 <dd><p>Don&rsquo;t create fragments that are shorter than <var>duration</var> microseconds long.
1207 </p></dd>
1208 </dl>
1209
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.
1214 </p>
1215 <p>Additionally, the way the output file is written can be adjusted
1216 through a few other options:
1217 </p>
1218 <dl compact="compact">
1219 <dt> &lsquo;<samp>-movflags empty_moov</samp>&rsquo;</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
1225 a zero duration.
1226 </p>
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.
1229 </p></dd>
1230 <dt> &lsquo;<samp>-movflags separate_moof</samp>&rsquo;</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.
1235 </p>
1236 <p>This option is implicitly set when writing ismv (Smooth Streaming) files.
1237 </p></dd>
1238 <dt> &lsquo;<samp>-movflags faststart</samp>&rsquo;</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.
1242 </p></dd>
1243 <dt> &lsquo;<samp>-movflags rtphint</samp>&rsquo;</dt>
1244 <dd><p>Add RTP hinting tracks to the output file.
1245 </p></dd>
1246 </dl>
1247
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>&nbsp;</td><td><pre class="example">ffmpeg -re <var>&lt;normal input/transcoding options&gt;</var> -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
1251 </pre></td></tr></table>
1252
1253 <a name="mp3"></a>
1254 <h2 class="section"><a href="ffmpeg-formats.html#toc-mp3">4.12 mp3</a></h2>
1255
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.
1260 </p>
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
1263 of VBR files.
1264 </p>
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.
1271 </p>
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.
1275 </p>
1276 <p>Examples:
1277 </p>
1278 <p>Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
1279 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
1280 </pre></td></tr></table>
1281
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>&nbsp;</td><td><pre class="example">ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1
1285 -metadata:s:v title=&quot;Album cover&quot; -metadata:s:v comment=&quot;Cover (Front)&quot; out.mp3
1286 </pre></td></tr></table>
1287
1288 <a name="mpegts"></a>
1289 <h2 class="section"><a href="ffmpeg-formats.html#toc-mpegts">4.13 mpegts</a></h2>
1290
1291 <p>MPEG transport stream muxer.
1292 </p>
1293 <p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
1294 </p>
1295 <p>The muxer options are:
1296 </p>
1297 <dl compact="compact">
1298 <dt> &lsquo;<samp>-mpegts_original_network_id <var>number</var></samp>&rsquo;</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.
1302 </p></dd>
1303 <dt> &lsquo;<samp>-mpegts_transport_stream_id <var>number</var></samp>&rsquo;</dt>
1304 <dd><p>Set the transport_stream_id (default 0x0001). This identifies a
1305 transponder in DVB.
1306 </p></dd>
1307 <dt> &lsquo;<samp>-mpegts_service_id <var>number</var></samp>&rsquo;</dt>
1308 <dd><p>Set the service_id (default 0x0001) also known as program in DVB.
1309 </p></dd>
1310 <dt> &lsquo;<samp>-mpegts_pmt_start_pid <var>number</var></samp>&rsquo;</dt>
1311 <dd><p>Set the first PID for PMT (default 0x1000, max 0x1f00).
1312 </p></dd>
1313 <dt> &lsquo;<samp>-mpegts_start_pid <var>number</var></samp>&rsquo;</dt>
1314 <dd><p>Set the first PID for data packets (default 0x0100, max 0x0f00).
1315 </p></dd>
1316 <dt> &lsquo;<samp>-mpegts_m2ts_mode <var>number</var></samp>&rsquo;</dt>
1317 <dd><p>Enable m2ts mode if set to 1. Default value is -1 which disables m2ts mode.
1318 </p></dd>
1319 <dt> &lsquo;<samp>-muxrate <var>number</var></samp>&rsquo;</dt>
1320 <dd><p>Set muxrate.
1321 </p></dd>
1322 <dt> &lsquo;<samp>-pes_payload_size <var>number</var></samp>&rsquo;</dt>
1323 <dd><p>Set minimum PES packet payload in bytes.
1324 </p></dd>
1325 <dt> &lsquo;<samp>-mpegts_flags <var>flags</var></samp>&rsquo;</dt>
1326 <dd><p>Set flags (see below).
1327 </p></dd>
1328 <dt> &lsquo;<samp>-mpegts_copyts <var>number</var></samp>&rsquo;</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.
1331 </p></dd>
1332 <dt> &lsquo;<samp>-tables_version <var>number</var></samp>&rsquo;</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>&nbsp;</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
1339 ...
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
1343 ...
1344 </pre></td></tr></table>
1345 </dd>
1346 </dl>
1347
1348 <p>Option mpegts_flags may take a set of such flags:
1349 </p>
1350 <dl compact="compact">
1351 <dt> &lsquo;<samp>resend_headers</samp>&rsquo;</dt>
1352 <dd><p>Reemit PAT/PMT before writing the next packet.
1353 </p></dd>
1354 <dt> &lsquo;<samp>latm</samp>&rsquo;</dt>
1355 <dd><p>Use LATM packetization for AAC.
1356 </p></dd>
1357 </dl>
1358
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 &quot;FFmpeg&quot; and the default for
1362 <code>service_name</code> is &quot;Service01&quot;.
1363 </p>
1364 <table><tr><td>&nbsp;</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=&quot;Some provider&quot; \
1371      -metadata service_name=&quot;Some Channel&quot; \
1372      -y out.ts
1373 </pre></td></tr></table>
1374
1375 <a name="null"></a>
1376 <h2 class="section"><a href="ffmpeg-formats.html#toc-null">4.14 null</a></h2>
1377
1378 <p>Null muxer.
1379 </p>
1380 <p>This muxer does not generate any output file, it is mainly useful for
1381 testing or benchmarking purposes.
1382 </p>
1383 <p>For example to benchmark decoding with <code>ffmpeg</code> you can use the
1384 command:
1385 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
1386 </pre></td></tr></table>
1387
1388 <p>Note that the above command does not read or write the &lsquo;<tt>out.null</tt>&rsquo;
1389 file, but specifying the output file is required by the <code>ffmpeg</code>
1390 syntax.
1391 </p>
1392 <p>Alternatively you can write the command as:
1393 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null -
1394 </pre></td></tr></table>
1395
1396 <a name="ogg"></a>
1397 <h2 class="section"><a href="ffmpeg-formats.html#toc-ogg">4.15 ogg</a></h2>
1398
1399 <p>Ogg container muxer.
1400 </p>
1401 <dl compact="compact">
1402 <dt> &lsquo;<samp>-page_duration <var>duration</var></samp>&rsquo;</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
1409 overhead.
1410 </p></dd>
1411 </dl>
1412
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>
1415
1416 <p>Basic stream segmenter.
1417 </p>
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>.
1421 </p>
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>.
1426 </p>
1427 <p>Every segment starts with a keyframe of the selected reference stream,
1428 which is set through the &lsquo;<samp>reference_stream</samp>&rsquo; option.
1429 </p>
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
1434 time.
1435 </p>
1436 <p>The segment muxer works best with a single constant frame rate video.
1437 </p>
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
1442 files.
1443 </p>
1444 <p>The segment muxer supports the following options:
1445 </p>
1446 <dl compact="compact">
1447 <dt> &lsquo;<samp>reference_stream <var>specifier</var></samp>&rsquo;</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 &ldquo;Stream
1451 specifiers&rdquo; chapter in the ffmpeg manual) which specifies the
1452 reference stream. The default value is <code>auto</code>.
1453 </p>
1454 </dd>
1455 <dt> &lsquo;<samp>segment_format <var>format</var></samp>&rsquo;</dt>
1456 <dd><p>Override the inner container format, by default it is guessed by the filename
1457 extension.
1458 </p>
1459 </dd>
1460 <dt> &lsquo;<samp>segment_list <var>name</var></samp>&rsquo;</dt>
1461 <dd><p>Generate also a listfile named <var>name</var>. If not specified no
1462 listfile is generated.
1463 </p>
1464 </dd>
1465 <dt> &lsquo;<samp>segment_list_flags <var>flags</var></samp>&rsquo;</dt>
1466 <dd><p>Set flags affecting the segment list generation.
1467 </p>
1468 <p>It currently supports the following flags:
1469 </p><dl compact="compact">
1470 <dt> &lsquo;<samp>cache</samp>&rsquo;</dt>
1471 <dd><p>Allow caching (only affects M3U8 list files).
1472 </p>
1473 </dd>
1474 <dt> &lsquo;<samp>live</samp>&rsquo;</dt>
1475 <dd><p>Allow live-friendly file generation.
1476 </p></dd>
1477 </dl>
1478
1479 </dd>
1480 <dt> &lsquo;<samp>segment_list_size <var>size</var></samp>&rsquo;</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
1483 value is 0.
1484 </p>
1485 </dd>
1486 <dt> &lsquo;<samp>segment_list_entry_prefix <var>prefix</var></samp>&rsquo;</dt>
1487 <dd><p>Set <var>prefix</var> to prepend to the name of each entry filename. By
1488 default no prefix is applied.
1489 </p>
1490 </dd>
1491 <dt> &lsquo;<samp>segment_list_type <var>type</var></samp>&rsquo;</dt>
1492 <dd><p>Specify the format for the segment list file.
1493 </p>
1494 <p>The following values are recognized:
1495 </p><dl compact="compact">
1496 <dt> &lsquo;<samp>flat</samp>&rsquo;</dt>
1497 <dd><p>Generate a flat list for the created segments, one segment per line.
1498 </p>
1499 </dd>
1500 <dt> &lsquo;<samp>csv, ext</samp>&rsquo;</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>&nbsp;</td><td><pre class="example"><var>segment_filename</var>,<var>segment_start_time</var>,<var>segment_end_time</var>
1504 </pre></td></tr></table>
1505
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.
1509 </p>
1510 <p><var>segment_start_time</var> and <var>segment_end_time</var> specify
1511 the segment start and end time expressed in seconds.
1512 </p>
1513 <p>A list file with the suffix <code>&quot;.csv&quot;</code> or <code>&quot;.ext&quot;</code> will
1514 auto-select this format.
1515 </p>
1516 <p>&lsquo;<samp>ext</samp>&rsquo; is deprecated in favor or &lsquo;<samp>csv</samp>&rsquo;.
1517 </p>
1518 </dd>
1519 <dt> &lsquo;<samp>ffconcat</samp>&rsquo;</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.
1522 </p>
1523 <p>A list file with the suffix <code>&quot;.ffcat&quot;</code> or <code>&quot;.ffconcat&quot;</code> will
1524 auto-select this format.
1525 </p>
1526 </dd>
1527 <dt> &lsquo;<samp>m3u8</samp>&rsquo;</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>.
1530 </p>
1531 <p>A list file with the suffix <code>&quot;.m3u8&quot;</code> will auto-select this format.
1532 </p></dd>
1533 </dl>
1534
1535 <p>If not specified the type is guessed from the list file name suffix.
1536 </p>
1537 </dd>
1538 <dt> &lsquo;<samp>segment_time <var>time</var></samp>&rsquo;</dt>
1539 <dd><p>Set segment duration to <var>time</var>, the value must be a duration
1540 specification. Default value is &quot;2&quot;. See also the
1541 &lsquo;<samp>segment_times</samp>&rsquo; option.
1542 </p>
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.
1546 </p>
1547 </dd>
1548 <dt> &lsquo;<samp>segment_time_delta <var>delta</var></samp>&rsquo;</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 &quot;0&quot;.
1551 </p>
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>&nbsp;</td><td><pre class="example">PTS &gt;= start_time - time_delta
1555 </pre></td></tr></table>
1556
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.
1560 </p>
1561 <p>In particular may be used in combination with the &lsquo;<tt>ffmpeg</tt>&rsquo; 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>.
1568 </p>
1569 </dd>
1570 <dt> &lsquo;<samp>segment_times <var>times</var></samp>&rsquo;</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 &lsquo;<samp>segment_time</samp>&rsquo; option.
1574 </p>
1575 </dd>
1576 <dt> &lsquo;<samp>segment_frames <var>frames</var></samp>&rsquo;</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.
1579 </p>
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.
1583 </p>
1584 </dd>
1585 <dt> &lsquo;<samp>segment_wrap <var>limit</var></samp>&rsquo;</dt>
1586 <dd><p>Wrap around segment index once it reaches <var>limit</var>.
1587 </p>
1588 </dd>
1589 <dt> &lsquo;<samp>segment_start_number <var>number</var></samp>&rsquo;</dt>
1590 <dd><p>Set the sequence number of the first segment. Defaults to <code>0</code>.
1591 </p>
1592 </dd>
1593 <dt> &lsquo;<samp>reset_timestamps <var>1|0</var></samp>&rsquo;</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.
1598 </p>
1599 </dd>
1600 <dt> &lsquo;<samp>initial_offset <var>offset</var></samp>&rsquo;</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.
1603 </p></dd>
1604 </dl>
1605
1606 <a name="Examples"></a>
1607 <h3 class="subsection"><a href="ffmpeg-formats.html#toc-Examples">4.16.1 Examples</a></h3>
1608
1609 <ul>
1610 <li>
1611 To remux the content of file &lsquo;<tt>in.mkv</tt>&rsquo; to a list of segments
1612 &lsquo;<tt>out-000.nut</tt>&rsquo;, &lsquo;<tt>out-001.nut</tt>&rsquo;, etc., and write the list of
1613 generated segments to &lsquo;<tt>out.list</tt>&rsquo;:
1614 <table><tr><td>&nbsp;</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>
1616
1617 </li><li>
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>&nbsp;</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>
1622
1623 </li><li>
1624 As the example above, but use the <code>ffmpeg</code> &lsquo;<samp>force_key_frames</samp>&rsquo;
1625 option to force key frames in the input at the specified location, together
1626 with the segment option &lsquo;<samp>segment_time_delta</samp>&rsquo; to account for
1627 possible roundings operated when setting key frame times.
1628 <table><tr><td>&nbsp;</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
1632 required.
1633 </p>
1634 </li><li>
1635 Segment the input file by splitting the input file according to the
1636 frame numbers sequence specified with the &lsquo;<samp>segment_frames</samp>&rsquo; option:
1637 <table><tr><td>&nbsp;</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>
1639
1640 </li><li>
1641 To convert the &lsquo;<tt>in.mkv</tt>&rsquo; to TS segments using the <code>libx264</code>
1642 and <code>libfaac</code> encoders:
1643 <table><tr><td>&nbsp;</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>
1645
1646 </li><li>
1647 Segment the input file, and create an M3U8 live playlist (can be used
1648 as live HLS source):
1649 <table><tr><td>&nbsp;</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>
1652 </li></ul>
1653
1654 <a name="tee"></a>
1655 <h2 class="section"><a href="ffmpeg-formats.html#toc-tee">4.17 tee</a></h2>
1656
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.
1660 </p>
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.
1666 </p>
1667 <p>The slave outputs are specified in the file name given to the muxer,
1668 separated by &rsquo;|&rsquo;. If any of the slave name contains the &rsquo;|&rsquo; separator,
1669 leading or trailing spaces or any special character, it must be
1670 escaped (see the &ldquo;Quoting and escaping&rdquo; section in the ffmpeg-utils
1671 manual).
1672 </p>
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 &rsquo;:&rsquo;, between square brackets. If
1675 the options values contain a special character or the &rsquo;:&rsquo; separator, they
1676 must be escaped; note that this is a second level escaping.
1677 </p>
1678 <p>The following special options are also recognized:
1679 </p><dl compact="compact">
1680 <dt> &lsquo;<samp>f</samp>&rsquo;</dt>
1681 <dd><p>Specify the format name. Useful if it cannot be guessed from the
1682 output name suffix.
1683 </p>
1684 </dd>
1685 <dt> &lsquo;<samp>bsfs[/<var>spec</var>]</samp>&rsquo;</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.
1691 </p>
1692 <p>Several bitstream filters can be specified, separated by &quot;,&quot;.
1693 </p>
1694 </dd>
1695 <dt> &lsquo;<samp>select</samp>&rsquo;</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.
1699 </p></dd>
1700 </dl>
1701
1702 <p>Some examples follow.
1703 </p><ul>
1704 <li>
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>&nbsp;</td><td><pre class="example">ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
1708   &quot;archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/&quot;
1709 </pre></td></tr></table>
1710
1711 </li><li>
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 &lsquo;<tt>out.aac</tt>&rsquo; in order to make it contain only
1717 audio packets.
1718 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac -strict experimental
1719        -f tee &quot;[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac&quot;
1720 </pre></td></tr></table>
1721 </li></ul>
1722
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 &lsquo;<samp>global_header</samp>&rsquo; flag.
1726 </p>
1727 <a name="Metadata"></a>
1728 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Metadata">5. Metadata</a></h1>
1729
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.
1732 </p>
1733 <p>The file format is as follows:
1734 </p><ol>
1735 <li>
1736 A file consists of a header and a number of metadata tags divided into sections,
1737 each on its own line.
1738
1739 </li><li>
1740 The header is a &rsquo;;FFMETADATA&rsquo; string, followed by a version number (now 1).
1741
1742 </li><li>
1743 Metadata tags are of the form &rsquo;key=value&rsquo;
1744
1745 </li><li>
1746 Immediately after header follows global metadata
1747
1748 </li><li>
1749 After global metadata there may be sections with per-stream/per-chapter
1750 metadata.
1751
1752 </li><li>
1753 A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
1754 brackets (&rsquo;[&rsquo;, &rsquo;]&rsquo;) and ends with next section or end of file.
1755
1756 </li><li>
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 &rsquo;TIMEBASE=num/den&rsquo;, where num and
1759 den are integers. If the timebase is missing then start/end times are assumed to
1760 be in milliseconds.
1761 Next a chapter section must contain chapter start and end times in form
1762 &rsquo;START=num&rsquo;, &rsquo;END=num&rsquo;, where num is a positive integer.
1763
1764 </li><li>
1765 Empty lines and lines starting with &rsquo;;&rsquo; or &rsquo;#&rsquo; are ignored.
1766
1767 </li><li>
1768 Metadata keys or values containing special characters (&rsquo;=&rsquo;, &rsquo;;&rsquo;, &rsquo;#&rsquo;, &rsquo;\&rsquo; and a
1769 newline) must be escaped with a backslash &rsquo;\&rsquo;.
1770
1771 </li><li>
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 &rsquo;foo &rsquo;, value is &rsquo; bar&rsquo;).
1774 </li></ol>
1775
1776 <p>A ffmetadata file might look like this:
1777 </p><table><tr><td>&nbsp;</td><td><pre class="example">;FFMETADATA1
1778 title=bike\\shed
1779 ;this is a comment
1780 artist=FFmpeg troll team
1781
1782 [CHAPTER]
1783 TIMEBASE=1/1000
1784 START=0
1785 #chapter ends at 0:01:00
1786 END=60000
1787 title=chapter \#1
1788 [STREAM]
1789 title=multi\
1790 line
1791 </pre></td></tr></table>
1792
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.
1796 </p>
1797 <p>Extracting an ffmetadata file with &lsquo;<tt>ffmpeg</tt>&rsquo; goes as follows:
1798 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
1799 </pre></td></tr></table>
1800
1801 <p>Reinserting edited metadata information from the FFMETADATAFILE file can
1802 be done as:
1803 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
1804 </pre></td></tr></table>
1805
1806
1807 <a name="See-Also"></a>
1808 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-See-Also">6. See Also</a></h1>
1809
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>
1812 </p>
1813
1814 <a name="Authors"></a>
1815 <h1 class="chapter"><a href="ffmpeg-formats.html#toc-Authors">7. Authors</a></h1>
1816
1817 <p>The FFmpeg developers.
1818 </p>
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>.
1823 </p>
1824 <p>Maintainers for the specific components are listed in the file
1825 &lsquo;<tt>MAINTAINERS</tt>&rsquo; in the source code tree.
1826 </p>
1827
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>