package ffmpeg-avcodec

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Audio codecs.

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

Main types for audio codecs.

type id = [
  1. | `Pcm_s16le
  2. | `Pcm_s16be
  3. | `Pcm_u16le
  4. | `Pcm_u16be
  5. | `Pcm_s8
  6. | `Pcm_u8
  7. | `Pcm_mulaw
  8. | `Pcm_alaw
  9. | `Pcm_s32le
  10. | `Pcm_s32be
  11. | `Pcm_u32le
  12. | `Pcm_u32be
  13. | `Pcm_s24le
  14. | `Pcm_s24be
  15. | `Pcm_u24le
  16. | `Pcm_u24be
  17. | `Pcm_s24daud
  18. | `Pcm_zork
  19. | `Pcm_s16le_planar
  20. | `Pcm_dvd
  21. | `Pcm_f32be
  22. | `Pcm_f32le
  23. | `Pcm_f64be
  24. | `Pcm_f64le
  25. | `Pcm_bluray
  26. | `Pcm_lxf
  27. | `S302m
  28. | `Pcm_s8_planar
  29. | `Pcm_s24le_planar
  30. | `Pcm_s32le_planar
  31. | `Pcm_s16be_planar
  32. | `Pcm_s64le
  33. | `Pcm_s64be
  34. | `Pcm_f16le
  35. | `Pcm_f24le
  36. | `Pcm_vidc
  37. | `Pcm_sga
  38. | `Adpcm_ima_qt
  39. | `Adpcm_ima_wav
  40. | `Adpcm_ima_dk3
  41. | `Adpcm_ima_dk4
  42. | `Adpcm_ima_ws
  43. | `Adpcm_ima_smjpeg
  44. | `Adpcm_ms
  45. | `Adpcm_4xm
  46. | `Adpcm_xa
  47. | `Adpcm_adx
  48. | `Adpcm_ea
  49. | `Adpcm_g726
  50. | `Adpcm_ct
  51. | `Adpcm_swf
  52. | `Adpcm_yamaha
  53. | `Adpcm_sbpro_4
  54. | `Adpcm_sbpro_3
  55. | `Adpcm_sbpro_2
  56. | `Adpcm_thp
  57. | `Adpcm_ima_amv
  58. | `Adpcm_ea_r1
  59. | `Adpcm_ea_r3
  60. | `Adpcm_ea_r2
  61. | `Adpcm_ima_ea_sead
  62. | `Adpcm_ima_ea_eacs
  63. | `Adpcm_ea_xas
  64. | `Adpcm_ea_maxis_xa
  65. | `Adpcm_ima_iss
  66. | `Adpcm_g722
  67. | `Adpcm_ima_apc
  68. | `Adpcm_vima
  69. | `Adpcm_afc
  70. | `Adpcm_ima_oki
  71. | `Adpcm_dtk
  72. | `Adpcm_ima_rad
  73. | `Adpcm_g726le
  74. | `Adpcm_thp_le
  75. | `Adpcm_psx
  76. | `Adpcm_aica
  77. | `Adpcm_ima_dat4
  78. | `Adpcm_mtaf
  79. | `Adpcm_agm
  80. | `Adpcm_argo
  81. | `Adpcm_ima_ssi
  82. | `Adpcm_zork
  83. | `Adpcm_ima_apm
  84. | `Adpcm_ima_alp
  85. | `Adpcm_ima_mtf
  86. | `Adpcm_ima_cunning
  87. | `Adpcm_ima_moflex
  88. | `Adpcm_ima_acorn
  89. | `Amr_nb
  90. | `Amr_wb
  91. | `Ra_144
  92. | `Ra_288
  93. | `Roq_dpcm
  94. | `Interplay_dpcm
  95. | `Xan_dpcm
  96. | `Sol_dpcm
  97. | `Sdx2_dpcm
  98. | `Gremlin_dpcm
  99. | `Derf_dpcm
  100. | `Mp2
  101. | `Mp3
  102. | `Aac
  103. | `Ac3
  104. | `Dts
  105. | `Vorbis
  106. | `Dvaudio
  107. | `Wmav1
  108. | `Wmav2
  109. | `Mace3
  110. | `Mace6
  111. | `Vmdaudio
  112. | `Flac
  113. | `Mp3adu
  114. | `Mp3on4
  115. | `Shorten
  116. | `Alac
  117. | `Westwood_snd1
  118. | `Gsm
  119. | `Qdm2
  120. | `Cook
  121. | `Truespeech
  122. | `Tta
  123. | `Smackaudio
  124. | `Qcelp
  125. | `Wavpack
  126. | `Dsicinaudio
  127. | `Imc
  128. | `Musepack7
  129. | `Mlp
  130. | `Gsm_ms
  131. | `Atrac3
  132. | `Ape
  133. | `Nellymoser
  134. | `Musepack8
  135. | `Speex
  136. | `Wmavoice
  137. | `Wmapro
  138. | `Wmalossless
  139. | `Atrac3p
  140. | `Eac3
  141. | `Sipr
  142. | `Mp1
  143. | `Twinvq
  144. | `Truehd
  145. | `Mp4als
  146. | `Atrac1
  147. | `Binkaudio_rdft
  148. | `Binkaudio_dct
  149. | `Aac_latm
  150. | `Qdmc
  151. | `Celt
  152. | `G723_1
  153. | `G729
  154. | `_8svx_exp
  155. | `_8svx_fib
  156. | `Bmv_audio
  157. | `Ralf
  158. | `Iac
  159. | `Ilbc
  160. | `Opus
  161. | `Comfort_noise
  162. | `Tak
  163. | `Metasound
  164. | `Paf_audio
  165. | `On2avc
  166. | `Dss_sp
  167. | `Codec2
  168. | `Ffwavesynth
  169. | `Sonic
  170. | `Sonic_ls
  171. | `Evrc
  172. | `Smv
  173. | `Dsd_lsbf
  174. | `Dsd_msbf
  175. | `Dsd_lsbf_planar
  176. | `Dsd_msbf_planar
  177. | `_4gv
  178. | `Interplay_acm
  179. | `Xma1
  180. | `Xma2
  181. | `Dst
  182. | `Atrac3al
  183. | `Atrac3pal
  184. | `Dolby_e
  185. | `Aptx
  186. | `Aptx_hd
  187. | `Sbc
  188. | `Atrac9
  189. | `Hcom
  190. | `Acelp_kelvin
  191. | `Mpegh_3d_audio
  192. | `Siren
  193. | `Hca
  194. | `Fastaudio
  195. | `Msnsiren
  196. | `Dfpwm
]

Audio 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 : [ `Pcm_s16le | `Pcm_s16be | `Pcm_u16le | `Pcm_u16be | `Pcm_s8 | `Pcm_u8 | `Pcm_mulaw | `Pcm_alaw | `Pcm_s32le | `Pcm_s32be | `Pcm_u32le | `Pcm_u32be | `Pcm_s24le | `Pcm_s24be | `Pcm_u24le | `Pcm_u24be | `Pcm_s24daud | `Pcm_zork | `Pcm_s16le_planar | `Pcm_dvd | `Pcm_f32be | `Pcm_f32le | `Pcm_f64be | `Pcm_f64le | `Pcm_bluray | `Pcm_lxf | `S302m | `Pcm_s8_planar | `Pcm_s24le_planar | `Pcm_s32le_planar | `Pcm_s16be_planar | `Pcm_s64le | `Pcm_s64be | `Pcm_f16le | `Pcm_f24le | `Pcm_vidc | `Pcm_sga | `Adpcm_ima_qt | `Adpcm_ima_wav | `Adpcm_ima_dk3 | `Adpcm_ima_dk4 | `Adpcm_ima_ws | `Adpcm_ima_smjpeg | `Adpcm_ms | `Adpcm_4xm | `Adpcm_xa | `Adpcm_adx | `Adpcm_ea | `Adpcm_g726 | `Adpcm_ct | `Adpcm_swf | `Adpcm_yamaha | `Adpcm_sbpro_4 | `Adpcm_sbpro_3 | `Adpcm_sbpro_2 | `Adpcm_thp | `Adpcm_ima_amv | `Adpcm_ea_r1 | `Adpcm_ea_r3 | `Adpcm_ea_r2 | `Adpcm_ima_ea_sead | `Adpcm_ima_ea_eacs | `Adpcm_ea_xas | `Adpcm_ea_maxis_xa | `Adpcm_ima_iss | `Adpcm_g722 | `Adpcm_ima_apc | `Adpcm_vima | `Adpcm_afc | `Adpcm_ima_oki | `Adpcm_dtk | `Adpcm_ima_rad | `Adpcm_g726le | `Adpcm_thp_le | `Adpcm_psx | `Adpcm_aica | `Adpcm_ima_dat4 | `Adpcm_mtaf | `Adpcm_agm | `Adpcm_argo | `Adpcm_ima_ssi | `Adpcm_zork | `Adpcm_ima_apm | `Adpcm_ima_alp | `Adpcm_ima_mtf | `Adpcm_ima_cunning | `Adpcm_ima_moflex | `Adpcm_ima_acorn | `Amr_nb | `Amr_wb | `Ra_144 | `Ra_288 | `Roq_dpcm | `Interplay_dpcm | `Xan_dpcm | `Sol_dpcm | `Sdx2_dpcm | `Gremlin_dpcm | `Derf_dpcm | `Mp2 | `Mp3 | `Aac | `Ac3 | `Dts | `Vorbis | `Dvaudio | `Wmav1 | `Wmav2 | `Mace3 | `Mace6 | `Vmdaudio | `Flac | `Mp3adu | `Mp3on4 | `Shorten | `Alac | `Westwood_snd1 | `Gsm | `Qdm2 | `Cook | `Truespeech | `Tta | `Smackaudio | `Qcelp | `Wavpack | `Dsicinaudio | `Imc | `Musepack7 | `Mlp | `Gsm_ms | `Atrac3 | `Ape | `Nellymoser | `Musepack8 | `Speex | `Wmavoice | `Wmapro | `Wmalossless | `Atrac3p | `Eac3 | `Sipr | `Mp1 | `Twinvq | `Truehd | `Mp4als | `Atrac1 | `Binkaudio_rdft | `Binkaudio_dct | `Aac_latm | `Qdmc | `Celt | `G723_1 | `G729 | `_8svx_exp | `_8svx_fib | `Bmv_audio | `Ralf | `Iac | `Ilbc | `Opus | `Comfort_noise | `Tak | `Metasound | `Paf_audio | `On2avc | `Dss_sp | `Codec2 | `Ffwavesynth | `Sonic | `Sonic_ls | `Evrc | `Smv | `Dsd_lsbf | `Dsd_msbf | `Dsd_lsbf_planar | `Dsd_msbf_planar | `_4gv | `Interplay_acm | `Xma1 | `Xma2 | `Dst | `Atrac3al | `Atrac3pal | `Dolby_e | `Aptx | `Aptx_hd | `Sbc | `Atrac9 | `Hcom | `Acelp_kelvin | `Mpegh_3d_audio | `Siren | `Hca | `Fastaudio | `Msnsiren | `Dfpwm ] list

List of all audio codec IDs.

val encoders : encode t list

List of all available audio encoders.

val decoders : decode t list

List of all available audio 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_channel_layouts : _ t -> Avutil.Channel_layout.t list

Return the list of supported channel layouts of the codec.

val find_best_channel_layout : _ t -> Avutil.Channel_layout.t -> Avutil.Channel_layout.t

Avcodec.Audio.find_best_channel_layout codec default return the best channel layout of the codec codec or the default value if the codec has no channel layout.

val get_supported_sample_formats : _ t -> Avutil.Sample_format.t list

Return the list of supported sample formats of the codec.

val find_best_sample_format : _ t -> Avutil.Sample_format.t -> Avutil.Sample_format.t

Avcodec.Audio.find_best_sample_format codec default return the best sample format of the codec codec or the default value if the codec has no sample format.

val get_supported_sample_rates : _ t -> int list

Return the list of supported sample rates of the codec.

val find_best_sample_rate : _ t -> int -> int

Avcodec.Audio.find_best_sample_rate codec default return the best sample rate of the codec codec or the default value if the codec has no sample rate.

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

Avcodec.Audio.create_parser codec create an audio packet parser.

Raise Error if the parser creation failed.

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

Avcodec.Audio.create_decoder ~params codec create an audio decoder.

Raise Error if the decoder creation failed.

Avcodec.Audio.sample_format decoder returns the output sample format for the given decoder.

val create_encoder : ?opts:Avutil.opts -> ?channels:int -> ?channel_layout:Avutil.Channel_layout.t -> sample_rate:int -> sample_format:Avutil.Sample_format.t -> time_base:Avutil.rational -> encode t -> Avutil.audio encoder

Avcodec.Audio.create_encoder create an audio encoder.

Params have the same semantics as in Av.new_audio_stream

Raise Error if the encoder creation failed.

val frame_size : Avutil.audio encoder -> int

Get the desired frame_size for this encoder.

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 ID.

val get_id : _ t -> id

Return the ID (class) of a codec.

val get_params_id : Avutil.audio params -> id

Return the id of the codec params.

val get_channel_layout : Avutil.audio params -> Avutil.Channel_layout.t

Return the channel layout set for the codec params.

val get_nb_channels : Avutil.audio params -> int

Returns the number of channels set for the codec params.

val get_sample_format : Avutil.audio params -> Avutil.Sample_format.t

Returns the sample format set for the codec params.

val get_bit_rate : Avutil.audio params -> int

Returns the bit rate set for the codec params.

val get_sample_rate : Avutil.audio params -> int

Returns the sample rate set for the codec.