formats.texi 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. @chapter Format Options
  2. @c man begin FORMAT OPTIONS
  3. The libavformat library provides some generic global options, which
  4. can be set on all the muxers and demuxers. In addition each muxer or
  5. demuxer may support so-called private options, which are specific for
  6. that component.
  7. Options may be set by specifying -@var{option} @var{value} in the
  8. FFmpeg tools, or by setting the value explicitly in the
  9. @code{AVFormatContext} options or using the @file{libavutil/opt.h} API
  10. for programmatic use.
  11. The list of supported options follows:
  12. @table @option
  13. @item avioflags @var{flags} (@emph{input/output})
  14. Possible values:
  15. @table @samp
  16. @item direct
  17. Reduce buffering.
  18. @end table
  19. @item probesize @var{integer} (@emph{input})
  20. Set probing size in bytes, i.e. the size of the data to analyze to get
  21. stream information. A higher value will enable detecting more
  22. information in case it is dispersed into the stream, but will increase
  23. latency. Must be an integer not lesser than 32. It is 5000000 by default.
  24. @item max_probe_packets @var{integer} (@emph{input})
  25. Set the maximum number of buffered packets when probing a codec.
  26. Default is 2500 packets.
  27. @item packetsize @var{integer} (@emph{output})
  28. Set packet size.
  29. @item fflags @var{flags}
  30. Set format flags. Some are implemented for a limited number of formats.
  31. Possible values for input files:
  32. @table @samp
  33. @item discardcorrupt
  34. Discard corrupted packets.
  35. @item fastseek
  36. Enable fast, but inaccurate seeks for some formats.
  37. @item genpts
  38. Generate missing PTS if DTS is present.
  39. @item igndts
  40. Ignore DTS if PTS is also set. In case the PTS is set, the DTS value
  41. is set to NOPTS. This is ignored when the @code{nofillin} flag is set.
  42. @item ignidx
  43. Ignore index.
  44. @item nobuffer
  45. Reduce the latency introduced by buffering during initial input streams analysis.
  46. @item nofillin
  47. Do not fill in missing values in packet fields that can be exactly calculated.
  48. @item noparse
  49. Disable AVParsers, this needs @code{+nofillin} too.
  50. @item sortdts
  51. Try to interleave output packets by DTS. At present, available only for AVIs with an index.
  52. @end table
  53. Possible values for output files:
  54. @table @samp
  55. @item autobsf
  56. Automatically apply bitstream filters as required by the output format. Enabled by default.
  57. @item bitexact
  58. Only write platform-, build- and time-independent data.
  59. This ensures that file and data checksums are reproducible and match between
  60. platforms. Its primary use is for regression testing.
  61. @item flush_packets
  62. Write out packets immediately.
  63. @item shortest
  64. Stop muxing at the end of the shortest stream.
  65. It may be needed to increase max_interleave_delta to avoid flushing the longer
  66. streams before EOF.
  67. @end table
  68. @item seek2any @var{integer} (@emph{input})
  69. Allow seeking to non-keyframes on demuxer level when supported if set to 1.
  70. Default is 0.
  71. @item analyzeduration @var{integer} (@emph{input})
  72. Specify how many microseconds are analyzed to probe the input. A
  73. higher value will enable detecting more accurate information, but will
  74. increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
  75. @item cryptokey @var{hexadecimal string} (@emph{input})
  76. Set decryption key.
  77. @item indexmem @var{integer} (@emph{input})
  78. Set max memory used for timestamp index (per stream).
  79. @item rtbufsize @var{integer} (@emph{input})
  80. Set max memory used for buffering real-time frames.
  81. @item fdebug @var{flags} (@emph{input/output})
  82. Print specific debug info.
  83. Possible values:
  84. @table @samp
  85. @item ts
  86. @end table
  87. @item max_delay @var{integer} (@emph{input/output})
  88. Set maximum muxing or demuxing delay in microseconds.
  89. @item fpsprobesize @var{integer} (@emph{input})
  90. Set number of frames used to probe fps.
  91. @item audio_preload @var{integer} (@emph{output})
  92. Set microseconds by which audio packets should be interleaved earlier.
  93. @item chunk_duration @var{integer} (@emph{output})
  94. Set microseconds for each chunk.
  95. @item chunk_size @var{integer} (@emph{output})
  96. Set size in bytes for each chunk.
  97. @item err_detect, f_err_detect @var{flags} (@emph{input})
  98. Set error detection flags. @code{f_err_detect} is deprecated and
  99. should be used only via the @command{ffmpeg} tool.
  100. Possible values:
  101. @table @samp
  102. @item crccheck
  103. Verify embedded CRCs.
  104. @item bitstream
  105. Detect bitstream specification deviations.
  106. @item buffer
  107. Detect improper bitstream length.
  108. @item explode
  109. Abort decoding on minor error detection.
  110. @item careful
  111. Consider things that violate the spec and have not been seen in the
  112. wild as errors.
  113. @item compliant
  114. Consider all spec non compliancies as errors.
  115. @item aggressive
  116. Consider things that a sane encoder should not do as an error.
  117. @end table
  118. @item max_interleave_delta @var{integer} (@emph{output})
  119. Set maximum buffering duration for interleaving. The duration is
  120. expressed in microseconds, and defaults to 10000000 (10 seconds).
  121. To ensure all the streams are interleaved correctly, libavformat will
  122. wait until it has at least one packet for each stream before actually
  123. writing any packets to the output file. When some streams are
  124. "sparse" (i.e. there are large gaps between successive packets), this
  125. can result in excessive buffering.
  126. This field specifies the maximum difference between the timestamps of the
  127. first and the last packet in the muxing queue, above which libavformat
  128. will output a packet regardless of whether it has queued a packet for all
  129. the streams.
  130. If set to 0, libavformat will continue buffering packets until it has
  131. a packet for each stream, regardless of the maximum timestamp
  132. difference between the buffered packets.
  133. @item use_wallclock_as_timestamps @var{integer} (@emph{input})
  134. Use wallclock as timestamps if set to 1. Default is 0.
  135. @item avoid_negative_ts @var{integer} (@emph{output})
  136. Possible values:
  137. @table @samp
  138. @item make_non_negative
  139. Shift timestamps to make them non-negative.
  140. Also note that this affects only leading negative timestamps, and not
  141. non-monotonic negative timestamps.
  142. @item make_zero
  143. Shift timestamps so that the first timestamp is 0.
  144. @item auto (default)
  145. Enables shifting when required by the target format.
  146. @item disabled
  147. Disables shifting of timestamp.
  148. @end table
  149. When shifting is enabled, all output timestamps are shifted by the
  150. same amount. Audio, video, and subtitles desynching and relative
  151. timestamp differences are preserved compared to how they would have
  152. been without shifting.
  153. @item skip_initial_bytes @var{integer} (@emph{input})
  154. Set number of bytes to skip before reading header and frames if set to 1.
  155. Default is 0.
  156. @item correct_ts_overflow @var{integer} (@emph{input})
  157. Correct single timestamp overflows if set to 1. Default is 1.
  158. @item flush_packets @var{integer} (@emph{output})
  159. Flush the underlying I/O stream after each packet. Default is -1 (auto), which
  160. means that the underlying protocol will decide, 1 enables it, and has the
  161. effect of reducing the latency, 0 disables it and may increase IO throughput in
  162. some cases.
  163. @item output_ts_offset @var{offset} (@emph{output})
  164. Set the output time offset.
  165. @var{offset} must be a time duration specification,
  166. see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  167. The offset is added by the muxer to the output timestamps.
  168. Specifying a positive offset means that the corresponding streams are
  169. delayed bt the time duration specified in @var{offset}. Default value
  170. is @code{0} (meaning that no offset is applied).
  171. @item format_whitelist @var{list} (@emph{input})
  172. "," separated list of allowed demuxers. By default all are allowed.
  173. @item dump_separator @var{string} (@emph{input})
  174. Separator used to separate the fields printed on the command line about the
  175. Stream parameters.
  176. For example, to separate the fields with newlines and indentation:
  177. @example
  178. ffprobe -dump_separator "
  179. " -i ~/videos/matrixbench_mpeg2.mpg
  180. @end example
  181. @item max_streams @var{integer} (@emph{input})
  182. Specifies the maximum number of streams. This can be used to reject files that
  183. would require too many resources due to a large number of streams.
  184. @item skip_estimate_duration_from_pts @var{bool} (@emph{input})
  185. Skip estimation of input duration if it requires an additional probing for PTS at end of file.
  186. At present, applicable for MPEG-PS and MPEG-TS.
  187. @item duration_probesize @var{integer} (@emph{input})
  188. Set probing size, in bytes, for input duration estimation when it actually requires
  189. an additional probing for PTS at end of file (at present: MPEG-PS and MPEG-TS).
  190. It is aimed at users interested in better durations probing for itself, or indirectly
  191. because using the concat demuxer, for example.
  192. The typical use case is an MPEG-TS CBR with a high bitrate, high video buffering and
  193. ending cleaning with similar PTS for video and audio: in such a scenario, the large
  194. physical gap between the last video packet and the last audio packet makes it necessary
  195. to read many bytes in order to get the video stream duration.
  196. Another use case is where the default probing behaviour only reaches a single video frame which is
  197. not the last one of the stream due to frame reordering, so the duration is not accurate.
  198. Setting this option has a performance impact even for small files because the probing
  199. size is fixed.
  200. Default behaviour is a general purpose trade-off, largely adaptive, but the probing size
  201. will not be extended to get streams durations at all costs.
  202. Must be an integer not lesser than 1, or 0 for default behaviour.
  203. @item strict, f_strict @var{integer} (@emph{input/output})
  204. Specify how strictly to follow the standards. @code{f_strict} is deprecated and
  205. should be used only via the @command{ffmpeg} tool.
  206. Possible values:
  207. @table @samp
  208. @item very
  209. strictly conform to an older more strict version of the spec or reference software
  210. @item strict
  211. strictly conform to all the things in the spec no matter what consequences
  212. @item normal
  213. @item unofficial
  214. allow unofficial extensions
  215. @item experimental
  216. allow non standardized experimental things, experimental
  217. (unfinished/work in progress/not well tested) decoders and encoders.
  218. Note: experimental decoders can pose a security risk, do not use this for
  219. decoding untrusted input.
  220. @end table
  221. @end table
  222. @c man end FORMAT OPTIONS
  223. @anchor{Format stream specifiers}
  224. @section Format stream specifiers
  225. Format stream specifiers allow selection of one or more streams that
  226. match specific properties.
  227. The exact semantics of stream specifiers is defined by the
  228. @code{avformat_match_stream_specifier()} function declared in the
  229. @file{libavformat/avformat.h} header and documented in the
  230. @ref{Stream specifiers,,Stream specifiers section in the ffmpeg(1) manual,ffmpeg}.
  231. @ifclear config-writeonly
  232. @include demuxers.texi
  233. @end ifclear
  234. @ifclear config-readonly
  235. @include muxers.texi
  236. @end ifclear
  237. @include metadata.texi