Module Avcodec

This module contains decoders and encoders for audio, video and subtitle codecs.

type ('media, 'mode) codec
type 'media params
type 'media decoder
type 'media encoder
type encode = [
  1. | `Encoder
]
type decode = [
  1. | `Decoder
]
type profile = {
  1. id : int;
  2. profile_name : string;
}
type descriptor = {
  1. media_type : Avutil.media_type;
  2. name : string;
  3. long_name : string option;
  4. properties : [ `Intra_only | `Lossy | `Lossless | `Reorder | `Fields | `Bitmap_sub | `Text_sub ] list;
  5. mime_types : string list;
  6. profiles : profile list;
}
Constants
val flag_qscale : int
val params : 'media encoder -> 'media params

Get the params of a given encoder

val descriptor : 'media params -> descriptor option

Get the params descriptor.

val time_base : 'media encoder -> Avutil.rational

Get the time base of a given encoder.

val name : (_, _) codec -> string

Get the name of a given codec.

type capability = [
  1. | `Draw_horiz_band
  2. | `Dr1
  3. | `Delay
  4. | `Small_last_frame
  5. | `Subframes
  6. | `Experimental
  7. | `Channel_conf
  8. | `Frame_threads
  9. | `Slice_threads
  10. | `Param_change
  11. | `Other_threads
  12. | `Variable_frame_size
  13. | `Avoid_probing
  14. | `Hardware
  15. | `Hybrid
  16. | `Encoder_reordered_opaque
  17. | `Encoder_flush
  18. | `Encoder_recon_frame
]

Codec capabilities.

val capabilities : ([< `Audio | `Video ], encode) codec -> capability list

Get the encoding capabilities for this codec.

type hw_config_method = [
  1. | `Hw_device_ctx
  2. | `Hw_frames_ctx
  3. | `Internal
  4. | `Ad_hoc
]

Codec hardware config method.

type hw_config = {
  1. pixel_format : Avutil.Pixel_format.t;
  2. methods : hw_config_method list;
  3. device_type : Avutil.HwContext.device_type;
}

Hardward config for the given codec.

val hw_configs : ([< `Audio | `Video ], _) codec -> hw_config list

Get the codec's hardward configs.

module Packet : sig ... end

Packet.

module Audio : sig ... end

Audio codecs.

module Video : sig ... end

Video codecs.

module Subtitle : sig ... end

Subtitle codecs.

module Unknown : sig ... end
type id = [
  1. | `None
  2. | `Mpeg1video
  3. | `Mpeg2video
  4. | `H261
  5. | `H263
  6. | `Rv10
  7. | `Rv20
  8. | `Mjpeg
  9. | `Mjpegb
  10. | `Ljpeg
  11. | `Sp5x
  12. | `Jpegls
  13. | `Mpeg4
  14. | `Rawvideo
  15. | `Msmpeg4v1
  16. | `Msmpeg4v2
  17. | `Msmpeg4v3
  18. | `Wmv1
  19. | `Wmv2
  20. | `H263p
  21. | `H263i
  22. | `Flv1
  23. | `Svq1
  24. | `Svq3
  25. | `Dvvideo
  26. | `Huffyuv
  27. | `Cyuv
  28. | `H264
  29. | `Indeo3
  30. | `Vp3
  31. | `Theora
  32. | `Asv1
  33. | `Asv2
  34. | `Ffv1
  35. | `_4xm
  36. | `Vcr1
  37. | `Cljr
  38. | `Mdec
  39. | `Roq
  40. | `Interplay_video
  41. | `Xan_wc3
  42. | `Xan_wc4
  43. | `Rpza
  44. | `Cinepak
  45. | `Ws_vqa
  46. | `Msrle
  47. | `Msvideo1
  48. | `Idcin
  49. | `_8bps
  50. | `Smc
  51. | `Flic
  52. | `Truemotion1
  53. | `Vmdvideo
  54. | `Mszh
  55. | `Zlib
  56. | `Qtrle
  57. | `Tscc
  58. | `Ulti
  59. | `Qdraw
  60. | `Vixl
  61. | `Qpeg
  62. | `Png
  63. | `Ppm
  64. | `Pbm
  65. | `Pgm
  66. | `Pgmyuv
  67. | `Pam
  68. | `Ffvhuff
  69. | `Rv30
  70. | `Rv40
  71. | `Vc1
  72. | `Wmv3
  73. | `Loco
  74. | `Wnv1
  75. | `Aasc
  76. | `Indeo2
  77. | `Fraps
  78. | `Truemotion2
  79. | `Bmp
  80. | `Cscd
  81. | `Mmvideo
  82. | `Zmbv
  83. | `Avs
  84. | `Smackvideo
  85. | `Nuv
  86. | `Kmvc
  87. | `Flashsv
  88. | `Cavs
  89. | `Jpeg2000
  90. | `Vmnc
  91. | `Vp5
  92. | `Vp6
  93. | `Vp6f
  94. | `Targa
  95. | `Dsicinvideo
  96. | `Tiertexseqvideo
  97. | `Tiff
  98. | `Gif
  99. | `Dxa
  100. | `Dnxhd
  101. | `Thp
  102. | `Sgi
  103. | `C93
  104. | `Bethsoftvid
  105. | `Ptx
  106. | `Txd
  107. | `Vp6a
  108. | `Amv
  109. | `Vb
  110. | `Pcx
  111. | `Sunrast
  112. | `Indeo4
  113. | `Indeo5
  114. | `Mimic
  115. | `Rl2
  116. | `Escape124
  117. | `Dirac
  118. | `Bfi
  119. | `Cmv
  120. | `Motionpixels
  121. | `Tgv
  122. | `Tgq
  123. | `Tqi
  124. | `Aura
  125. | `Aura2
  126. | `V210x
  127. | `Tmv
  128. | `V210
  129. | `Dpx
  130. | `Mad
  131. | `Frwu
  132. | `Flashsv2
  133. | `Cdgraphics
  134. | `R210
  135. | `Anm
  136. | `Binkvideo
  137. | `Iff_ilbm
  138. | `Kgv1
  139. | `Yop
  140. | `Vp8
  141. | `Pictor
  142. | `Ansi
  143. | `A64_multi
  144. | `A64_multi5
  145. | `R10k
  146. | `Mxpeg
  147. | `Lagarith
  148. | `Prores
  149. | `Jv
  150. | `Dfa
  151. | `Wmv3image
  152. | `Vc1image
  153. | `Utvideo
  154. | `Bmv_video
  155. | `Vble
  156. | `Dxtory
  157. | `V410
  158. | `Xwd
  159. | `Cdxl
  160. | `Xbm
  161. | `Zerocodec
  162. | `Mss1
  163. | `Msa1
  164. | `Tscc2
  165. | `Mts2
  166. | `Cllc
  167. | `Mss2
  168. | `Vp9
  169. | `Aic
  170. | `Escape130
  171. | `G2m
  172. | `Webp
  173. | `Hnm4_video
  174. | `Hevc
  175. | `Fic
  176. | `Alias_pix
  177. | `Brender_pix
  178. | `Paf_video
  179. | `Exr
  180. | `Vp7
  181. | `Sanm
  182. | `Sgirle
  183. | `Mvc1
  184. | `Mvc2
  185. | `Hqx
  186. | `Tdsc
  187. | `Hq_hqa
  188. | `Hap
  189. | `Dds
  190. | `Dxv
  191. | `Screenpresso
  192. | `Rscc
  193. | `Avs2
  194. | `Pgx
  195. | `Avs3
  196. | `Msp2
  197. | `Vvc
  198. | `Y41p
  199. | `Avrp
  200. | `_012v
  201. | `Avui
  202. | `Ayuv
  203. | `Targa_y216
  204. | `V308
  205. | `V408
  206. | `Yuv4
  207. | `Avrn
  208. | `Cpia
  209. | `Xface
  210. | `Snow
  211. | `Smvjpeg
  212. | `Apng
  213. | `Daala
  214. | `Cfhd
  215. | `Truemotion2rt
  216. | `M101
  217. | `Magicyuv
  218. | `Sheervideo
  219. | `Ylc
  220. | `Psd
  221. | `Pixlet
  222. | `Speedhq
  223. | `Fmvc
  224. | `Scpr
  225. | `Clearvideo
  226. | `Xpm
  227. | `Av1
  228. | `Bitpacked
  229. | `Mscc
  230. | `Srgc
  231. | `Svg
  232. | `Gdv
  233. | `Fits
  234. | `Imm4
  235. | `Prosumer
  236. | `Mwsc
  237. | `Wcmv
  238. | `Rasc
  239. | `Hymt
  240. | `Arbc
  241. | `Agm
  242. | `Lscr
  243. | `Vp4
  244. | `Imm5
  245. | `Mvdv
  246. | `Mvha
  247. | `Cdtoons
  248. | `Mv30
  249. | `Notchlc
  250. | `Pfm
  251. | `Mobiclip
  252. | `Photocd
  253. | `Ipu
  254. | `Argo
  255. | `Cri
  256. | `Simbiosis_imx
  257. | `Sga_video
  258. | `Gem
  259. | `Vbn
  260. | `Jpegxl
  261. | `Qoi
  262. | `Phm
  263. | `Radiance_hdr
  264. | `Wbmp
  265. | `Media100
  266. | `Vqc
  267. | `Pdv
  268. | `Evc
  269. | `Rtv1
  270. | `Vmix
  271. | `First_audio
  272. | `Pcm_s16le
  273. | `Pcm_s16be
  274. | `Pcm_u16le
  275. | `Pcm_u16be
  276. | `Pcm_s8
  277. | `Pcm_u8
  278. | `Pcm_mulaw
  279. | `Pcm_alaw
  280. | `Pcm_s32le
  281. | `Pcm_s32be
  282. | `Pcm_u32le
  283. | `Pcm_u32be
  284. | `Pcm_s24le
  285. | `Pcm_s24be
  286. | `Pcm_u24le
  287. | `Pcm_u24be
  288. | `Pcm_s24daud
  289. | `Pcm_zork
  290. | `Pcm_s16le_planar
  291. | `Pcm_dvd
  292. | `Pcm_f32be
  293. | `Pcm_f32le
  294. | `Pcm_f64be
  295. | `Pcm_f64le
  296. | `Pcm_bluray
  297. | `Pcm_lxf
  298. | `S302m
  299. | `Pcm_s8_planar
  300. | `Pcm_s24le_planar
  301. | `Pcm_s32le_planar
  302. | `Pcm_s16be_planar
  303. | `Pcm_s64le
  304. | `Pcm_s64be
  305. | `Pcm_f16le
  306. | `Pcm_f24le
  307. | `Pcm_vidc
  308. | `Pcm_sga
  309. | `Adpcm_ima_qt
  310. | `Adpcm_ima_wav
  311. | `Adpcm_ima_dk3
  312. | `Adpcm_ima_dk4
  313. | `Adpcm_ima_ws
  314. | `Adpcm_ima_smjpeg
  315. | `Adpcm_ms
  316. | `Adpcm_4xm
  317. | `Adpcm_xa
  318. | `Adpcm_adx
  319. | `Adpcm_ea
  320. | `Adpcm_g726
  321. | `Adpcm_ct
  322. | `Adpcm_swf
  323. | `Adpcm_yamaha
  324. | `Adpcm_sbpro_4
  325. | `Adpcm_sbpro_3
  326. | `Adpcm_sbpro_2
  327. | `Adpcm_thp
  328. | `Adpcm_ima_amv
  329. | `Adpcm_ea_r1
  330. | `Adpcm_ea_r3
  331. | `Adpcm_ea_r2
  332. | `Adpcm_ima_ea_sead
  333. | `Adpcm_ima_ea_eacs
  334. | `Adpcm_ea_xas
  335. | `Adpcm_ea_maxis_xa
  336. | `Adpcm_ima_iss
  337. | `Adpcm_g722
  338. | `Adpcm_ima_apc
  339. | `Adpcm_vima
  340. | `Adpcm_afc
  341. | `Adpcm_ima_oki
  342. | `Adpcm_dtk
  343. | `Adpcm_ima_rad
  344. | `Adpcm_g726le
  345. | `Adpcm_thp_le
  346. | `Adpcm_psx
  347. | `Adpcm_aica
  348. | `Adpcm_ima_dat4
  349. | `Adpcm_mtaf
  350. | `Adpcm_agm
  351. | `Adpcm_argo
  352. | `Adpcm_ima_ssi
  353. | `Adpcm_zork
  354. | `Adpcm_ima_apm
  355. | `Adpcm_ima_alp
  356. | `Adpcm_ima_mtf
  357. | `Adpcm_ima_cunning
  358. | `Adpcm_ima_moflex
  359. | `Adpcm_ima_acorn
  360. | `Adpcm_xmd
  361. | `Amr_nb
  362. | `Amr_wb
  363. | `Ra_144
  364. | `Ra_288
  365. | `Roq_dpcm
  366. | `Interplay_dpcm
  367. | `Xan_dpcm
  368. | `Sol_dpcm
  369. | `Sdx2_dpcm
  370. | `Gremlin_dpcm
  371. | `Derf_dpcm
  372. | `Wady_dpcm
  373. | `Cbd2_dpcm
  374. | `Mp2
  375. | `Mp3
  376. | `Aac
  377. | `Ac3
  378. | `Dts
  379. | `Vorbis
  380. | `Dvaudio
  381. | `Wmav1
  382. | `Wmav2
  383. | `Mace3
  384. | `Mace6
  385. | `Vmdaudio
  386. | `Flac
  387. | `Mp3adu
  388. | `Mp3on4
  389. | `Shorten
  390. | `Alac
  391. | `Westwood_snd1
  392. | `Gsm
  393. | `Qdm2
  394. | `Cook
  395. | `Truespeech
  396. | `Tta
  397. | `Smackaudio
  398. | `Qcelp
  399. | `Wavpack
  400. | `Dsicinaudio
  401. | `Imc
  402. | `Musepack7
  403. | `Mlp
  404. | `Gsm_ms
  405. | `Atrac3
  406. | `Ape
  407. | `Nellymoser
  408. | `Musepack8
  409. | `Speex
  410. | `Wmavoice
  411. | `Wmapro
  412. | `Wmalossless
  413. | `Atrac3p
  414. | `Eac3
  415. | `Sipr
  416. | `Mp1
  417. | `Twinvq
  418. | `Truehd
  419. | `Mp4als
  420. | `Atrac1
  421. | `Binkaudio_rdft
  422. | `Binkaudio_dct
  423. | `Aac_latm
  424. | `Qdmc
  425. | `Celt
  426. | `G723_1
  427. | `G729
  428. | `_8svx_exp
  429. | `_8svx_fib
  430. | `Bmv_audio
  431. | `Ralf
  432. | `Iac
  433. | `Ilbc
  434. | `Opus
  435. | `Comfort_noise
  436. | `Tak
  437. | `Metasound
  438. | `Paf_audio
  439. | `On2avc
  440. | `Dss_sp
  441. | `Codec2
  442. | `Ffwavesynth
  443. | `Sonic
  444. | `Sonic_ls
  445. | `Evrc
  446. | `Smv
  447. | `Dsd_lsbf
  448. | `Dsd_msbf
  449. | `Dsd_lsbf_planar
  450. | `Dsd_msbf_planar
  451. | `_4gv
  452. | `Interplay_acm
  453. | `Xma1
  454. | `Xma2
  455. | `Dst
  456. | `Atrac3al
  457. | `Atrac3pal
  458. | `Dolby_e
  459. | `Aptx
  460. | `Aptx_hd
  461. | `Sbc
  462. | `Atrac9
  463. | `Hcom
  464. | `Acelp_kelvin
  465. | `Mpegh_3d_audio
  466. | `Siren
  467. | `Hca
  468. | `Fastaudio
  469. | `Msnsiren
  470. | `Dfpwm
  471. | `Bonk
  472. | `Misc4
  473. | `Apac
  474. | `Ftr
  475. | `Wavarc
  476. | `Rka
  477. | `Ac4
  478. | `Osq
  479. | `First_subtitle
  480. | `Dvd_subtitle
  481. | `Dvb_subtitle
  482. | `Text
  483. | `Xsub
  484. | `Ssa
  485. | `Mov_text
  486. | `Hdmv_pgs_subtitle
  487. | `Dvb_teletext
  488. | `Srt
  489. | `Microdvd
  490. | `Eia_608
  491. | `Jacosub
  492. | `Sami
  493. | `Realtext
  494. | `Stl
  495. | `Subviewer1
  496. | `Subviewer
  497. | `Subrip
  498. | `Webvtt
  499. | `Mpl2
  500. | `Vplayer
  501. | `Pjs
  502. | `Ass
  503. | `Hdmv_text_subtitle
  504. | `Ttml
  505. | `Arib_caption
  506. | `First_unknown
  507. | `Ttf
  508. | `Scte_35
  509. | `Epg
  510. | `Bintext
  511. | `Xbin
  512. | `Idf
  513. | `Otf
  514. | `Smpte_klv
  515. | `Dvd_nav
  516. | `Timed_id3
  517. | `Bin_data
  518. | `Smpte_2038
  519. | `Probe
  520. | `Mpeg2ts
  521. | `Mpeg4systems
  522. | `Ffmetadata
  523. | `Wrapped_avframe
  524. | `Vnull
  525. | `Anull
]
val string_of_id : id -> string
module BitstreamFilter : sig ... end
val decode : 'media decoder -> ('media Avutil.frame -> unit) -> 'media Packet.t -> unit

Avcodec.decode decoder f packet applies function f to the decoded frames frome the packet according to the decoder configuration.

Raise Error if the decoding failed.

val flush_decoder : 'media decoder -> ('media Avutil.frame -> unit) -> unit

Avcodec.flush_decoder decoder f applies function f to the decoded frames frome the buffered packets in the decoder.

Raise Error if the decoding failed.

val encode : 'media encoder -> ('media Packet.t -> unit) -> 'media Avutil.frame -> unit

Avcodec.encode encoder f frame applies function f to the encoded packets from the frame according to the encoder configuration.

Raise Error if the encoding failed.

val flush_encoder : 'media encoder -> ('media Packet.t -> unit) -> unit

Avcodec.flush_encoder encoder applies function f to the encoded packets from the buffered frames in the encoder.

Raise Error if the encoding failed.