Module Avcodec.Audio

Audio codecs.

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

Main types for audio codecs.

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

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 : [ `Wrapped_avframe | `None | `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 | `Adpcm_xmd | `Amr_nb | `Amr_wb | `Ra_144 | `Ra_288 | `Roq_dpcm | `Interplay_dpcm | `Xan_dpcm | `Sol_dpcm | `Sdx2_dpcm | `Gremlin_dpcm | `Derf_dpcm | `Wady_dpcm | `Cbd2_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 | `Bonk | `Misc4 | `Apac | `Ftr | `Wavarc | `Rka | `Ac4 | `Osq ] 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 -> 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.