Module Avcodec.Video

Video codecs.

type 'mode t = (Avutil.video, 'mode) codec

Main types for video codecs.

type id = [
  1. | `Wrapped_avframe
  2. | `None
  3. | `Mpeg1video
  4. | `Mpeg2video
  5. | `H261
  6. | `H263
  7. | `Rv10
  8. | `Rv20
  9. | `Mjpeg
  10. | `Mjpegb
  11. | `Ljpeg
  12. | `Sp5x
  13. | `Jpegls
  14. | `Mpeg4
  15. | `Rawvideo
  16. | `Msmpeg4v1
  17. | `Msmpeg4v2
  18. | `Msmpeg4v3
  19. | `Wmv1
  20. | `Wmv2
  21. | `H263p
  22. | `H263i
  23. | `Flv1
  24. | `Svq1
  25. | `Svq3
  26. | `Dvvideo
  27. | `Huffyuv
  28. | `Cyuv
  29. | `H264
  30. | `Indeo3
  31. | `Vp3
  32. | `Theora
  33. | `Asv1
  34. | `Asv2
  35. | `Ffv1
  36. | `_4xm
  37. | `Vcr1
  38. | `Cljr
  39. | `Mdec
  40. | `Roq
  41. | `Interplay_video
  42. | `Xan_wc3
  43. | `Xan_wc4
  44. | `Rpza
  45. | `Cinepak
  46. | `Ws_vqa
  47. | `Msrle
  48. | `Msvideo1
  49. | `Idcin
  50. | `_8bps
  51. | `Smc
  52. | `Flic
  53. | `Truemotion1
  54. | `Vmdvideo
  55. | `Mszh
  56. | `Zlib
  57. | `Qtrle
  58. | `Tscc
  59. | `Ulti
  60. | `Qdraw
  61. | `Vixl
  62. | `Qpeg
  63. | `Png
  64. | `Ppm
  65. | `Pbm
  66. | `Pgm
  67. | `Pgmyuv
  68. | `Pam
  69. | `Ffvhuff
  70. | `Rv30
  71. | `Rv40
  72. | `Vc1
  73. | `Wmv3
  74. | `Loco
  75. | `Wnv1
  76. | `Aasc
  77. | `Indeo2
  78. | `Fraps
  79. | `Truemotion2
  80. | `Bmp
  81. | `Cscd
  82. | `Mmvideo
  83. | `Zmbv
  84. | `Avs
  85. | `Smackvideo
  86. | `Nuv
  87. | `Kmvc
  88. | `Flashsv
  89. | `Cavs
  90. | `Jpeg2000
  91. | `Vmnc
  92. | `Vp5
  93. | `Vp6
  94. | `Vp6f
  95. | `Targa
  96. | `Dsicinvideo
  97. | `Tiertexseqvideo
  98. | `Tiff
  99. | `Gif
  100. | `Dxa
  101. | `Dnxhd
  102. | `Thp
  103. | `Sgi
  104. | `C93
  105. | `Bethsoftvid
  106. | `Ptx
  107. | `Txd
  108. | `Vp6a
  109. | `Amv
  110. | `Vb
  111. | `Pcx
  112. | `Sunrast
  113. | `Indeo4
  114. | `Indeo5
  115. | `Mimic
  116. | `Rl2
  117. | `Escape124
  118. | `Dirac
  119. | `Bfi
  120. | `Cmv
  121. | `Motionpixels
  122. | `Tgv
  123. | `Tgq
  124. | `Tqi
  125. | `Aura
  126. | `Aura2
  127. | `V210x
  128. | `Tmv
  129. | `V210
  130. | `Dpx
  131. | `Mad
  132. | `Frwu
  133. | `Flashsv2
  134. | `Cdgraphics
  135. | `R210
  136. | `Anm
  137. | `Binkvideo
  138. | `Iff_ilbm
  139. | `Kgv1
  140. | `Yop
  141. | `Vp8
  142. | `Pictor
  143. | `Ansi
  144. | `A64_multi
  145. | `A64_multi5
  146. | `R10k
  147. | `Mxpeg
  148. | `Lagarith
  149. | `Prores
  150. | `Jv
  151. | `Dfa
  152. | `Wmv3image
  153. | `Vc1image
  154. | `Utvideo
  155. | `Bmv_video
  156. | `Vble
  157. | `Dxtory
  158. | `V410
  159. | `Xwd
  160. | `Cdxl
  161. | `Xbm
  162. | `Zerocodec
  163. | `Mss1
  164. | `Msa1
  165. | `Tscc2
  166. | `Mts2
  167. | `Cllc
  168. | `Mss2
  169. | `Vp9
  170. | `Aic
  171. | `Escape130
  172. | `G2m
  173. | `Webp
  174. | `Hnm4_video
  175. | `Hevc
  176. | `Fic
  177. | `Alias_pix
  178. | `Brender_pix
  179. | `Paf_video
  180. | `Exr
  181. | `Vp7
  182. | `Sanm
  183. | `Sgirle
  184. | `Mvc1
  185. | `Mvc2
  186. | `Hqx
  187. | `Tdsc
  188. | `Hq_hqa
  189. | `Hap
  190. | `Dds
  191. | `Dxv
  192. | `Screenpresso
  193. | `Rscc
  194. | `Avs2
  195. | `Pgx
  196. | `Avs3
  197. | `Msp2
  198. | `Vvc
  199. | `Y41p
  200. | `Avrp
  201. | `_012v
  202. | `Avui
  203. | `Ayuv
  204. | `Targa_y216
  205. | `V308
  206. | `V408
  207. | `Yuv4
  208. | `Avrn
  209. | `Cpia
  210. | `Xface
  211. | `Snow
  212. | `Smvjpeg
  213. | `Apng
  214. | `Daala
  215. | `Cfhd
  216. | `Truemotion2rt
  217. | `M101
  218. | `Magicyuv
  219. | `Sheervideo
  220. | `Ylc
  221. | `Psd
  222. | `Pixlet
  223. | `Speedhq
  224. | `Fmvc
  225. | `Scpr
  226. | `Clearvideo
  227. | `Xpm
  228. | `Av1
  229. | `Bitpacked
  230. | `Mscc
  231. | `Srgc
  232. | `Svg
  233. | `Gdv
  234. | `Fits
  235. | `Imm4
  236. | `Prosumer
  237. | `Mwsc
  238. | `Wcmv
  239. | `Rasc
  240. | `Hymt
  241. | `Arbc
  242. | `Agm
  243. | `Lscr
  244. | `Vp4
  245. | `Imm5
  246. | `Mvdv
  247. | `Mvha
  248. | `Cdtoons
  249. | `Mv30
  250. | `Notchlc
  251. | `Pfm
  252. | `Mobiclip
  253. | `Photocd
  254. | `Ipu
  255. | `Argo
  256. | `Cri
  257. | `Simbiosis_imx
  258. | `Sga_video
  259. | `Gem
  260. | `Vbn
  261. | `Jpegxl
  262. | `Qoi
  263. | `Phm
  264. | `Radiance_hdr
  265. | `Wbmp
  266. | `Media100
  267. | `Vqc
  268. | `Pdv
  269. | `Evc
  270. | `Rtv1
  271. | `Vmix
]

Video codec ids. Careful: different codecs share the same ID, e.g. aac and libfdk_aac

val descriptor : id -> descriptor option

Get the codec descriptor.

val codec_ids : [ `Wrapped_avframe | `None | `Mpeg1video | `Mpeg2video | `H261 | `H263 | `Rv10 | `Rv20 | `Mjpeg | `Mjpegb | `Ljpeg | `Sp5x | `Jpegls | `Mpeg4 | `Rawvideo | `Msmpeg4v1 | `Msmpeg4v2 | `Msmpeg4v3 | `Wmv1 | `Wmv2 | `H263p | `H263i | `Flv1 | `Svq1 | `Svq3 | `Dvvideo | `Huffyuv | `Cyuv | `H264 | `Indeo3 | `Vp3 | `Theora | `Asv1 | `Asv2 | `Ffv1 | `_4xm | `Vcr1 | `Cljr | `Mdec | `Roq | `Interplay_video | `Xan_wc3 | `Xan_wc4 | `Rpza | `Cinepak | `Ws_vqa | `Msrle | `Msvideo1 | `Idcin | `_8bps | `Smc | `Flic | `Truemotion1 | `Vmdvideo | `Mszh | `Zlib | `Qtrle | `Tscc | `Ulti | `Qdraw | `Vixl | `Qpeg | `Png | `Ppm | `Pbm | `Pgm | `Pgmyuv | `Pam | `Ffvhuff | `Rv30 | `Rv40 | `Vc1 | `Wmv3 | `Loco | `Wnv1 | `Aasc | `Indeo2 | `Fraps | `Truemotion2 | `Bmp | `Cscd | `Mmvideo | `Zmbv | `Avs | `Smackvideo | `Nuv | `Kmvc | `Flashsv | `Cavs | `Jpeg2000 | `Vmnc | `Vp5 | `Vp6 | `Vp6f | `Targa | `Dsicinvideo | `Tiertexseqvideo | `Tiff | `Gif | `Dxa | `Dnxhd | `Thp | `Sgi | `C93 | `Bethsoftvid | `Ptx | `Txd | `Vp6a | `Amv | `Vb | `Pcx | `Sunrast | `Indeo4 | `Indeo5 | `Mimic | `Rl2 | `Escape124 | `Dirac | `Bfi | `Cmv | `Motionpixels | `Tgv | `Tgq | `Tqi | `Aura | `Aura2 | `V210x | `Tmv | `V210 | `Dpx | `Mad | `Frwu | `Flashsv2 | `Cdgraphics | `R210 | `Anm | `Binkvideo | `Iff_ilbm | `Kgv1 | `Yop | `Vp8 | `Pictor | `Ansi | `A64_multi | `A64_multi5 | `R10k | `Mxpeg | `Lagarith | `Prores | `Jv | `Dfa | `Wmv3image | `Vc1image | `Utvideo | `Bmv_video | `Vble | `Dxtory | `V410 | `Xwd | `Cdxl | `Xbm | `Zerocodec | `Mss1 | `Msa1 | `Tscc2 | `Mts2 | `Cllc | `Mss2 | `Vp9 | `Aic | `Escape130 | `G2m | `Webp | `Hnm4_video | `Hevc | `Fic | `Alias_pix | `Brender_pix | `Paf_video | `Exr | `Vp7 | `Sanm | `Sgirle | `Mvc1 | `Mvc2 | `Hqx | `Tdsc | `Hq_hqa | `Hap | `Dds | `Dxv | `Screenpresso | `Rscc | `Avs2 | `Pgx | `Avs3 | `Msp2 | `Vvc | `Y41p | `Avrp | `_012v | `Avui | `Ayuv | `Targa_y216 | `V308 | `V408 | `Yuv4 | `Avrn | `Cpia | `Xface | `Snow | `Smvjpeg | `Apng | `Daala | `Cfhd | `Truemotion2rt | `M101 | `Magicyuv | `Sheervideo | `Ylc | `Psd | `Pixlet | `Speedhq | `Fmvc | `Scpr | `Clearvideo | `Xpm | `Av1 | `Bitpacked | `Mscc | `Srgc | `Svg | `Gdv | `Fits | `Imm4 | `Prosumer | `Mwsc | `Wcmv | `Rasc | `Hymt | `Arbc | `Agm | `Lscr | `Vp4 | `Imm5 | `Mvdv | `Mvha | `Cdtoons | `Mv30 | `Notchlc | `Pfm | `Mobiclip | `Photocd | `Ipu | `Argo | `Cri | `Simbiosis_imx | `Sga_video | `Gem | `Vbn | `Jpegxl | `Qoi | `Phm | `Radiance_hdr | `Wbmp | `Media100 | `Vqc | `Pdv | `Evc | `Rtv1 | `Vmix ] list

List all video codec IDs.

val encoders : encode t list

List of all available video encoders.

val decoders : decode t list

List of all available video decoders.

val find_encoder_by_name : string -> encode t

Find an encoder from its name.

Raise Error if the codec is not found or is not an audio codec.

val find_encoder : id -> encode t

Find an encoder from its id.

Raise Error if the codec is not found or is not an audio codec.

val find_decoder_by_name : string -> decode t

Find a decoder from its name.

Raise Error if the codec is not found or is not an audio codec.

val find_decoder : id -> decode t

Find a decoder from its id.

Raise Error if the codec is not found or is not an audio codec.

val get_supported_frame_rates : _ t -> Avutil.rational list

Return the list of supported frame rates of the codec.

val find_best_frame_rate : _ t -> Avutil.rational -> Avutil.rational

Avcodec.Video.find_best_frame_rate codec default return the best frame rate of the codec codec or the default value if the codec has no frame rate.

val get_supported_pixel_formats : _ t -> Avutil.Pixel_format.t list

Return the list of supported pixel formats of the codec.

val find_best_pixel_format : ?hwaccel:bool -> _ t -> Avutil.Pixel_format.t -> Avutil.Pixel_format.t

Avcodec.Video.find_best_pixel_format codec default return the best pixel format of the codec codec or the default value if the codec has no pixel format.

val create_parser : ?params:Avutil.video params -> decode t -> Avutil.video Packet.parser

Avcodec.Video.create_parser codec create an video packet parser.

Raise Error if the parser creation failed.

val create_decoder : ?params:Avutil.video params -> decode t -> Avutil.video decoder

Avcodec.Video.create_decoder codec create a video decoder.

Raise Error if the decoder creation failed.

type hardware_context = [
  1. | `Device_context of Avutil.HwContext.device_context
  2. | `Frame_context of Avutil.HwContext.frame_context
]
val create_encoder : ?opts:Avutil.opts -> ?frame_rate:Avutil.rational -> ?hardware_context:hardware_context -> pixel_format:Avutil.Pixel_format.t -> width:int -> height:int -> time_base:Avutil.rational -> encode t -> Avutil.video encoder

Avcodec.Video.create_encoder create a video encoder.

Params have the same semantics as in Av.new_video_stream

Raise Error if the encoder creation failed.

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

Return the name of a codec.

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

Return the description of a codec.

val string_of_id : id -> string

Return the name of the codec.

val get_id : _ t -> id

Return the ID (class) of a codec.

val get_params_id : Avutil.video params -> id

Return the id of the codec params.

val get_width : Avutil.video params -> int

Returns the width set for the codec params.

val get_height : Avutil.video params -> int

Returns the height set for the codec params.

val get_sample_aspect_ratio : Avutil.video params -> Avutil.rational

Returns the sample aspect ratio set for the codec params.

val get_pixel_format : Avutil.video params -> Avutil.Pixel_format.t option

Returns the pixel format set for the codec params.

val get_pixel_aspect : Avutil.video params -> Avutil.rational option

Returns the pixel aspect set for the codec params.

val get_bit_rate : Avutil.video params -> int

Returns the bit rate set for the codec.