Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

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