decoders.texi 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. @chapter Decoders
  2. @c man begin DECODERS
  3. Decoders are configured elements in FFmpeg which allow the decoding of
  4. multimedia streams.
  5. When you configure your FFmpeg build, all the supported native decoders
  6. are enabled by default. Decoders requiring an external library must be enabled
  7. manually via the corresponding @code{--enable-lib} option. You can list all
  8. available decoders using the configure option @code{--list-decoders}.
  9. You can disable all the decoders with the configure option
  10. @code{--disable-decoders} and selectively enable / disable single decoders
  11. with the options @code{--enable-decoder=@var{DECODER}} /
  12. @code{--disable-decoder=@var{DECODER}}.
  13. The option @code{-decoders} of the ff* tools will display the list of
  14. enabled decoders.
  15. @c man end DECODERS
  16. @chapter Video Decoders
  17. @c man begin VIDEO DECODERS
  18. A description of some of the currently available video decoders
  19. follows.
  20. @section av1
  21. AOMedia Video 1 (AV1) decoder.
  22. @subsection Options
  23. @table @option
  24. @item operating_point
  25. Select an operating point of a scalable AV1 bitstream (0 - 31). Default is 0.
  26. @end table
  27. @section rawvideo
  28. Raw video decoder.
  29. This decoder decodes rawvideo streams.
  30. @subsection Options
  31. @table @option
  32. @item top @var{top_field_first}
  33. Specify the assumed field type of the input video.
  34. @table @option
  35. @item -1
  36. the video is assumed to be progressive (default)
  37. @item 0
  38. bottom-field-first is assumed
  39. @item 1
  40. top-field-first is assumed
  41. @end table
  42. @end table
  43. @section libdav1d
  44. dav1d AV1 decoder.
  45. libdav1d allows libavcodec to decode the AOMedia Video 1 (AV1) codec.
  46. Requires the presence of the libdav1d headers and library during configuration.
  47. You need to explicitly configure the build with @code{--enable-libdav1d}.
  48. @subsection Options
  49. The following options are supported by the libdav1d wrapper.
  50. @table @option
  51. @item framethreads
  52. Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
  53. This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the
  54. option @code{max_frame_delay} and the global option @code{threads} instead.
  55. @item tilethreads
  56. Set amount of tile threads to use during decoding. The default value is 0 (autodetect).
  57. This option is deprecated for libdav1d >= 1.0 and will be removed in the future. Use the
  58. global option @code{threads} instead.
  59. @item max_frame_delay
  60. Set max amount of frames the decoder may buffer internally. The default value is 0
  61. (autodetect).
  62. @item filmgrain
  63. Apply film grain to the decoded video if present in the bitstream. Defaults to the
  64. internal default of the library.
  65. This option is deprecated and will be removed in the future. See the global option
  66. @code{export_side_data} to export Film Grain parameters instead of applying it.
  67. @item oppoint
  68. Select an operating point of a scalable AV1 bitstream (0 - 31). Defaults to the
  69. internal default of the library.
  70. @item alllayers
  71. Output all spatial layers of a scalable AV1 bitstream. The default value is false.
  72. @end table
  73. @section libdavs2
  74. AVS2-P2/IEEE1857.4 video decoder wrapper.
  75. This decoder allows libavcodec to decode AVS2 streams with davs2 library.
  76. @c man end VIDEO DECODERS
  77. @section libuavs3d
  78. AVS3-P2/IEEE1857.10 video decoder.
  79. libuavs3d allows libavcodec to decode AVS3 streams.
  80. Requires the presence of the libuavs3d headers and library during configuration.
  81. You need to explicitly configure the build with @code{--enable-libuavs3d}.
  82. @subsection Options
  83. The following option is supported by the libuavs3d wrapper.
  84. @table @option
  85. @item frame_threads
  86. Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
  87. @end table
  88. @section libxevd
  89. eXtra-fast Essential Video Decoder (XEVD) MPEG-5 EVC decoder wrapper.
  90. This decoder requires the presence of the libxevd headers and library
  91. during configuration. You need to explicitly configure the build with
  92. @option{--enable-libxevd}.
  93. The xevd project website is at @url{https://github.com/mpeg5/xevd}.
  94. @subsection Options
  95. The following options are supported by the libxevd wrapper.
  96. The xevd-equivalent options or values are listed in parentheses for easy migration.
  97. To get a more accurate and extensive documentation of the libxevd options,
  98. invoke the command @code{xevd_app --help} or consult the libxevd documentation.
  99. @table @option
  100. @item threads (@emph{threads})
  101. Force to use a specific number of threads
  102. @end table
  103. @section QSV Decoders
  104. The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
  105. JPEG/MJPEG, VP8, VP9, AV1).
  106. @subsection Common Options
  107. The following options are supported by all qsv decoders.
  108. @table @option
  109. @item @var{async_depth}
  110. Internal parallelization depth, the higher the value the higher the latency.
  111. @item @var{gpu_copy}
  112. A GPU-accelerated copy between video and system memory
  113. @table @samp
  114. @item default
  115. @item on
  116. @item off
  117. @end table
  118. @end table
  119. @subsection HEVC Options
  120. Extra options for hevc_qsv.
  121. @table @option
  122. @item @var{load_plugin}
  123. A user plugin to load in an internal session
  124. @table @samp
  125. @item none
  126. @item hevc_sw
  127. @item hevc_hw
  128. @end table
  129. @item @var{load_plugins}
  130. A :-separate list of hexadecimal plugin UIDs to load in an internal session
  131. @end table
  132. @section v210
  133. Uncompressed 4:2:2 10-bit decoder.
  134. @subsection Options
  135. @table @option
  136. @item custom_stride
  137. Set the line size of the v210 data in bytes. The default value is 0
  138. (autodetect). You can use the special -1 value for a strideless v210 as seen in
  139. BOXX files.
  140. @end table
  141. @c man end VIDEO DECODERS
  142. @chapter Audio Decoders
  143. @c man begin AUDIO DECODERS
  144. A description of some of the currently available audio decoders
  145. follows.
  146. @section ac3
  147. AC-3 audio decoder.
  148. This decoder implements part of ATSC A/52:2010 and ETSI TS 102 366, as well as
  149. the undocumented RealAudio 3 (a.k.a. dnet).
  150. @subsection AC-3 Decoder Options
  151. @table @option
  152. @item -drc_scale @var{value}
  153. Dynamic Range Scale Factor. The factor to apply to dynamic range values
  154. from the AC-3 stream. This factor is applied exponentially. The default value is 1.
  155. There are 3 notable scale factor ranges:
  156. @table @option
  157. @item drc_scale == 0
  158. DRC disabled. Produces full range audio.
  159. @item 0 < drc_scale <= 1
  160. DRC enabled. Applies a fraction of the stream DRC value.
  161. Audio reproduction is between full range and full compression.
  162. @item drc_scale > 1
  163. DRC enabled. Applies drc_scale asymmetrically.
  164. Loud sounds are fully compressed. Soft sounds are enhanced.
  165. @end table
  166. @end table
  167. @section flac
  168. FLAC audio decoder.
  169. This decoder aims to implement the complete FLAC specification from Xiph.
  170. @subsection FLAC Decoder options
  171. @table @option
  172. @item -use_buggy_lpc
  173. The lavc FLAC encoder used to produce buggy streams with high lpc values
  174. (like the default value). This option makes it possible to decode such streams
  175. correctly by using lavc's old buggy lpc logic for decoding.
  176. @end table
  177. @section ffwavesynth
  178. Internal wave synthesizer.
  179. This decoder generates wave patterns according to predefined sequences. Its
  180. use is purely internal and the format of the data it accepts is not publicly
  181. documented.
  182. @section libcelt
  183. libcelt decoder wrapper.
  184. libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec.
  185. Requires the presence of the libcelt headers and library during configuration.
  186. You need to explicitly configure the build with @code{--enable-libcelt}.
  187. @section libgsm
  188. libgsm decoder wrapper.
  189. libgsm allows libavcodec to decode the GSM full rate audio codec. Requires
  190. the presence of the libgsm headers and library during configuration. You need
  191. to explicitly configure the build with @code{--enable-libgsm}.
  192. This decoder supports both the ordinary GSM and the Microsoft variant.
  193. @section libilbc
  194. libilbc decoder wrapper.
  195. libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC)
  196. audio codec. Requires the presence of the libilbc headers and library during
  197. configuration. You need to explicitly configure the build with
  198. @code{--enable-libilbc}.
  199. @subsection Options
  200. The following option is supported by the libilbc wrapper.
  201. @table @option
  202. @item enhance
  203. Enable the enhancement of the decoded audio when set to 1. The default
  204. value is 0 (disabled).
  205. @end table
  206. @section libopencore-amrnb
  207. libopencore-amrnb decoder wrapper.
  208. libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate
  209. Narrowband audio codec. Using it requires the presence of the
  210. libopencore-amrnb headers and library during configuration. You need to
  211. explicitly configure the build with @code{--enable-libopencore-amrnb}.
  212. An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB
  213. without this library.
  214. @section libopencore-amrwb
  215. libopencore-amrwb decoder wrapper.
  216. libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate
  217. Wideband audio codec. Using it requires the presence of the
  218. libopencore-amrwb headers and library during configuration. You need to
  219. explicitly configure the build with @code{--enable-libopencore-amrwb}.
  220. An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB
  221. without this library.
  222. @section libopus
  223. libopus decoder wrapper.
  224. libopus allows libavcodec to decode the Opus Interactive Audio Codec.
  225. Requires the presence of the libopus headers and library during
  226. configuration. You need to explicitly configure the build with
  227. @code{--enable-libopus}.
  228. An FFmpeg native decoder for Opus exists, so users can decode Opus
  229. without this library.
  230. @c man end AUDIO DECODERS
  231. @chapter Subtitles Decoders
  232. @c man begin SUBTILES DECODERS
  233. @section libaribb24
  234. ARIB STD-B24 caption decoder.
  235. Implements profiles A and C of the ARIB STD-B24 standard.
  236. @subsection libaribb24 Decoder Options
  237. @table @option
  238. @item -aribb24-base-path @var{path}
  239. Sets the base path for the libaribb24 library. This is utilized for reading of
  240. configuration files (for custom unicode conversions), and for dumping of
  241. non-text symbols as images under that location.
  242. Unset by default.
  243. @item -aribb24-skip-ruby-text @var{boolean}
  244. Tells the decoder wrapper to skip text blocks that contain half-height ruby
  245. text.
  246. Enabled by default.
  247. @end table
  248. @section libaribcaption
  249. Yet another ARIB STD-B24 caption decoder using external @dfn{libaribcaption}
  250. library.
  251. Implements profiles A and C of the Japanse ARIB STD-B24 standard,
  252. Brazilian ABNT NBR 15606-1, and Philippines version of ISDB-T.
  253. Requires the presence of the libaribcaption headers and library
  254. (@url{https://github.com/xqq/libaribcaption}) during configuration.
  255. You need to explicitly configure the build with @code{--enable-libaribcaption}.
  256. If both @dfn{libaribb24} and @dfn{libaribcaption} are enabled, @dfn{libaribcaption}
  257. decoder precedes.
  258. @subsection libaribcaption Decoder Options
  259. @table @option
  260. @item -sub_type @var{subtitle_type}
  261. Specifies the format of the decoded subtitles.
  262. @table @samp
  263. @item bitmap
  264. Graphical image.
  265. @item ass
  266. ASS formatted text.
  267. @item text
  268. Simple text based output without formatting.
  269. @end table
  270. The default is @dfn{ass} as same as @dfn{libaribb24} decoder.
  271. Some present players (e.g., @dfn{mpv}) expect ASS format for ARIB caption.
  272. @item -caption_encoding @var{encoding_scheme}
  273. Specifies the encoding scheme of input subtitle text.
  274. @table @samp
  275. @item auto
  276. Automatically detect text encoding (default).
  277. @item jis
  278. 8bit-char JIS encoding defined in ARIB STD B24.
  279. This encoding used in Japan for ISDB captions.
  280. @item utf8
  281. UTF-8 encoding defined in ARIB STD B24.
  282. This encoding is used in Philippines for ISDB-T captions.
  283. @item latin
  284. Latin character encoding defined in ABNT NBR 15606-1.
  285. This encoding is used in South America for SBTVD / ISDB-Tb captions.
  286. @end table
  287. @item -font @var{font_name[,font_name2,...]}
  288. Specify comma-separated list of font family names to be used for @dfn{bitmap}
  289. or @dfn{ass} type subtitle rendering.
  290. Only first font name is used for @dfn{ass} type subtitle.
  291. If not specified, use internaly defined default font family.
  292. @item -ass_single_rect @var{boolean}
  293. ARIB STD-B24 specifies that some captions may be displayed at different
  294. positions at a time (multi-rectangle subtitle).
  295. Since some players (e.g., old @dfn{mpv}) can't handle multiple ASS rectangles
  296. in a single AVSubtitle, or multiple ASS rectangles of indeterminate duration
  297. with the same start timestamp, this option can change the behavior so that
  298. all the texts are displayed in a single ASS rectangle.
  299. The default is @var{false}.
  300. If your player cannot handle AVSubtitles with multiple ASS rectangles properly,
  301. set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change
  302. default behavior at compilation.
  303. @item -force_outline_text @var{boolean}
  304. Specify whether always render outline text for all characters regardless of
  305. the indication by charactor style.
  306. The default is @var{false}.
  307. @item -outline_width @var{number} (0.0 - 3.0)
  308. Specify width for outline text, in dots (relative).
  309. The default is @var{1.5}.
  310. @item -ignore_background @var{boolean}
  311. Specify whether to ignore background color rendering.
  312. The default is @var{false}.
  313. @item -ignore_ruby @var{boolean}
  314. Specify whether to ignore rendering for ruby-like (furigana) characters.
  315. The default is @var{false}.
  316. @item -replace_drcs @var{boolean}
  317. Specify whether to render replaced DRCS characters as Unicode characters.
  318. The default is @var{true}.
  319. @item -replace_msz_ascii @var{boolean}
  320. Specify whether to replace MSZ (Middle Size; half width) fullwidth
  321. alphanumerics with halfwidth alphanumerics.
  322. The default is @var{true}.
  323. @item -replace_msz_japanese @var{boolean}
  324. Specify whether to replace some MSZ (Middle Size; half width) fullwidth
  325. japanese special characters with halfwidth ones.
  326. The default is @var{true}.
  327. @item -replace_msz_glyph @var{boolean}
  328. Specify whether to replace MSZ (Middle Size; half width) characters
  329. with halfwidth glyphs if the fonts supports it.
  330. This option works under FreeType or DirectWrite renderer
  331. with Adobe-Japan1 compliant fonts.
  332. e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho,
  333. Yu Gothic, Yu Mincho, and Meiryo.
  334. The default is @var{true}.
  335. @item -canvas_size @var{image_size}
  336. Specify the resolution of the canvas to render subtitles to; usually, this
  337. should be frame size of input video.
  338. This only applies when @code{-subtitle_type} is set to @var{bitmap}.
  339. The libaribcaption decoder assumes input frame size for bitmap rendering as below:
  340. @enumerate
  341. @item
  342. PROFILE_A : 1440 x 1080 with SAR (PAR) 4:3
  343. @item
  344. PROFILE_C : 320 x 180 with SAR (PAR) 1:1
  345. @end enumerate
  346. If actual frame size of input video does not match above assumption,
  347. the rendered captions may be distorted.
  348. To make the captions undistorted, add @code{-canvas_size} option to specify
  349. actual input video size.
  350. Note that the @code{-canvas_size} option is not required for video with
  351. different size but same aspect ratio.
  352. In such cases, the caption will be stretched or shrunk to actual video size
  353. if @code{-canvas_size} option is not specified.
  354. If @code{-canvas_size} option is specified with different size,
  355. the caption will be stretched or shrunk as specified size with calculated SAR.
  356. @end table
  357. @subsection libaribcaption decoder usage examples
  358. Display MPEG-TS file with ARIB subtitle by @code{ffplay} tool:
  359. @example
  360. ffplay -sub_type bitmap MPEG.TS
  361. @end example
  362. Display MPEG-TS file with input frame size 1920x1080 by @code{ffplay} tool:
  363. @example
  364. ffplay -sub_type bitmap -canvas_size 1920x1080 MPEG.TS
  365. @end example
  366. Embed ARIB subtitle in transcoded video:
  367. @example
  368. ffmpeg -sub_type bitmap -i src.m2t -filter_complex "[0:v][0:s]overlay" -vcodec h264 dest.mp4
  369. @end example
  370. @section dvbsub
  371. @subsection Options
  372. @table @option
  373. @item compute_clut
  374. @table @option
  375. @item -2
  376. Compute clut once if no matching CLUT is in the stream.
  377. @item -1
  378. Compute clut if no matching CLUT is in the stream.
  379. @item 0
  380. Never compute CLUT
  381. @item 1
  382. Always compute CLUT and override the one provided in the stream.
  383. @end table
  384. @item dvb_substream
  385. Selects the dvb substream, or all substreams if -1 which is default.
  386. @end table
  387. @section dvdsub
  388. This codec decodes the bitmap subtitles used in DVDs; the same subtitles can
  389. also be found in VobSub file pairs and in some Matroska files.
  390. @subsection Options
  391. @table @option
  392. @item palette
  393. Specify the global palette used by the bitmaps. When stored in VobSub, the
  394. palette is normally specified in the index file; in Matroska, the palette is
  395. stored in the codec extra-data in the same format as in VobSub. In DVDs, the
  396. palette is stored in the IFO file, and therefore not available when reading
  397. from dumped VOB files.
  398. The format for this option is a string containing 16 24-bits hexadecimal
  399. numbers (without 0x prefix) separated by commas, for example @code{0d00ee,
  400. ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
  401. 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
  402. @item ifo_palette
  403. Specify the IFO file from which the global palette is obtained.
  404. (experimental)
  405. @item forced_subs_only
  406. Only decode subtitle entries marked as forced. Some titles have forced
  407. and non-forced subtitles in the same track. Setting this flag to @code{1}
  408. will only keep the forced subtitles. Default value is @code{0}.
  409. @end table
  410. @section libzvbi-teletext
  411. Libzvbi allows libavcodec to decode DVB teletext pages and DVB teletext
  412. subtitles. Requires the presence of the libzvbi headers and library during
  413. configuration. You need to explicitly configure the build with
  414. @code{--enable-libzvbi}.
  415. @subsection Options
  416. @table @option
  417. @item txt_page
  418. List of teletext page numbers to decode. Pages that do not match the specified
  419. list are dropped. You may use the special @code{*} string to match all pages,
  420. or @code{subtitle} to match all subtitle pages.
  421. Default value is *.
  422. @item txt_default_region
  423. Set default character set used for decoding, a value between 0 and 87 (see
  424. ETS 300 706, Section 15, Table 32). Default value is -1, which does not
  425. override the libzvbi default. This option is needed for some legacy level 1.0
  426. transmissions which cannot signal the proper charset.
  427. @item txt_chop_top
  428. Discards the top teletext line. Default value is 1.
  429. @item txt_format
  430. Specifies the format of the decoded subtitles.
  431. @table @option
  432. @item bitmap
  433. The default format, you should use this for teletext pages, because certain
  434. graphics and colors cannot be expressed in simple text or even ASS.
  435. @item text
  436. Simple text based output without formatting.
  437. @item ass
  438. Formatted ASS output, subtitle pages and teletext pages are returned in
  439. different styles, subtitle pages are stripped down to text, but an effort is
  440. made to keep the text alignment and the formatting.
  441. @end table
  442. @item txt_left
  443. X offset of generated bitmaps, default is 0.
  444. @item txt_top
  445. Y offset of generated bitmaps, default is 0.
  446. @item txt_chop_spaces
  447. Chops leading and trailing spaces and removes empty lines from the generated
  448. text. This option is useful for teletext based subtitles where empty spaces may
  449. be present at the start or at the end of the lines or empty lines may be
  450. present between the subtitle lines because of double-sized teletext characters.
  451. Default value is 1.
  452. @item txt_duration
  453. Sets the display duration of the decoded teletext pages or subtitles in
  454. milliseconds. Default value is -1 which means infinity or until the next
  455. subtitle event comes.
  456. @item txt_transparent
  457. Force transparent background of the generated teletext bitmaps. Default value
  458. is 0 which means an opaque background.
  459. @item txt_opacity
  460. Sets the opacity (0-255) of the teletext background. If
  461. @option{txt_transparent} is not set, it only affects characters between a start
  462. box and an end box, typically subtitles. Default value is 0 if
  463. @option{txt_transparent} is set, 255 otherwise.
  464. @end table
  465. @c man end SUBTILES DECODERS