decoders.texi 18 KB

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