Module Avcodec.Subtitle

Subtitle codecs: lookup only. This module builds no subtitle decoder or encoder. Subtitles are decoded and encoded through containers, in the Av library.

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

A subtitle codec.

type id = [
  1. | `None
  2. | `Dvd_subtitle
  3. | `Dvb_subtitle
  4. | `Text
  5. | `Xsub
  6. | `Ssa
  7. | `Mov_text
  8. | `Hdmv_pgs_subtitle
  9. | `Dvb_teletext
  10. | `Srt
  11. | `Microdvd
  12. | `Eia_608
  13. | `Jacosub
  14. | `Sami
  15. | `Realtext
  16. | `Stl
  17. | `Subviewer1
  18. | `Subviewer
  19. | `Subrip
  20. | `Webvtt
  21. | `Mpl2
  22. | `Vplayer
  23. | `Pjs
  24. | `Ass
  25. | `Hdmv_text_subtitle
  26. | `Ttml
  27. | `Arib_caption
  28. | `Ivtv_vbi
]

The identifier of a subtitle format, FFmpeg's AV_CODEC_ID_* values of the subtitle family.

val descriptor : id -> descriptor option

descriptor id is FFmpeg's descriptor of the format, None when FFmpeg has none for it. Every text of the result is a copy.

val codec_ids : [ `None | `Dvd_subtitle | `Dvb_subtitle | `Text | `Xsub | `Ssa | `Mov_text | `Hdmv_pgs_subtitle | `Dvb_teletext | `Srt | `Microdvd | `Eia_608 | `Jacosub | `Sami | `Realtext | `Stl | `Subviewer1 | `Subviewer | `Subrip | `Webvtt | `Mpl2 | `Vplayer | `Pjs | `Ass | `Hdmv_text_subtitle | `Ttml | `Arib_caption | `Ivtv_vbi ] list

Every subtitle identifier the bindings know.

val encoders : encode t list

The subtitle encoders FFmpeg registers, in FFmpeg's order. The list is built once, when this module is loaded. It holds the encoders whose identifier is in id, so get_id succeeds on each of them.

val decoders : decode t list

The subtitle decoders FFmpeg registers, under the rules of encoders.

val find_encoder_by_name : string -> encode t

find_encoder_by_name name is the subtitle encoder FFmpeg registers under name.

  • raises Avutil.Error

    with `Encoder_not_found when FFmpeg has no encoder of that name, or has one that is not a subtitle codec.

val find_encoder : id -> encode t

find_encoder id is an encoder FFmpeg registers for the format id.

  • raises Avutil.Error

    with `Encoder_not_found when FFmpeg has no encoder for it.

val find_decoder_by_name : string -> decode t

find_decoder_by_name name is the subtitle decoder FFmpeg registers under name.

  • raises Avutil.Error

    with `Decoder_not_found when FFmpeg has no decoder of that name, or has one that is not a subtitle codec.

val find_decoder : id -> decode t

find_decoder id is a decoder FFmpeg registers for the format id.

  • raises Avutil.Error

    with `Decoder_not_found when FFmpeg has no decoder for it.

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

get_name codec is the codec's name, as Avcodec.name.

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

get_description codec is the codec's descriptive name, the empty string when FFmpeg gives none.

val string_of_id : id -> string

string_of_id id is FFmpeg's name of the format.

val get_id : _ t -> id

get_id codec is the identifier of the format the codec implements.

val get_params_id : Avutil.subtitle params -> id

get_params_id params is the codec identifier of the parameters.

  • raises Avutil.Error

    with `Failure _ when the identifier is outside id.

val get_width : Avutil.subtitle params -> int

The size of the canvas a bitmap subtitle codec draws on, 0 when unset.

val get_height : Avutil.subtitle params -> int