File: all_codecs.ml

package info (click to toggle)
ocaml-ffmpeg 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 908 kB
  • sloc: ansic: 6,412; ml: 6,166; makefile: 3
file content (113 lines) | stat: -rw-r--r-- 3,219 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
let string_of_properties = function
  | `Intra_only -> "Intra only"
  | `Lossy -> "Lossy"
  | `Fields -> "Fields"
  | `Lossless -> "Lossless"
  | `Reorder -> "Reorder"
  | `Bitmap_sub -> "Bitmap sub"
  | `Text_sub -> "Text sub"

let string_of_media_type = function
  | `Unknown -> "unknown"
  | `Video -> "video"
  | `Audio -> "audio"
  | `Data -> "data"
  | `Subtitle -> "subtitle"
  | `Attachment -> "attachment"

let print_descriptor = function
  | None -> "(none)\n"
  | Some
      { Avcodec.media_type; name; long_name; mime_types; properties; profiles }
    ->
      Printf.sprintf
        "\n\
        \  Name: %s\n\
        \  Media type: %s\n\
        \  Long name: %s\n\
        \  Mime types: %s\n\
        \  Properties: %s\n\
        \  Profiles:%s\n"
        name
        (string_of_media_type media_type)
        (Option.value ~default:"(none)" long_name)
        (String.concat ", " mime_types)
        (String.concat ", " (List.map string_of_properties properties))
        (String.concat ""
           (List.map
              (fun { Avcodec.id; profile_name } ->
                Printf.sprintf "\n    ID: %i, name: %s" id profile_name)
              profiles))

let () =
  Printf.printf "====== Audio ======\n%!";
  List.iter
    (fun id ->
      Printf.printf "Available audio codec: %s\nDescriptor:%s\n"
        (Avcodec.Audio.string_of_id id)
        (print_descriptor (Avcodec.Audio.descriptor id)))
    Avcodec.Audio.codec_ids;

  List.iter
    (fun c ->
      Printf.printf "Available audio encoder: %s - %s\n%!"
        (Avcodec.Audio.get_name c)
        (Avcodec.Audio.get_description c))
    Avcodec.Audio.encoders;

  List.iter
    (fun c ->
      Printf.printf "Available audio decoder: %s - %s\n%!"
        (Avcodec.Audio.get_name c)
        (Avcodec.Audio.get_description c))
    Avcodec.Audio.decoders;

  Printf.printf "\n\n";

  Printf.printf "====== Video ======\n%!";

  List.iter
    (fun id ->
      Printf.printf "Available video codec: %s\nDescriptor:%s\n"
        (Avcodec.Video.string_of_id id)
        (print_descriptor (Avcodec.Video.descriptor id)))
    Avcodec.Video.codec_ids;

  List.iter
    (fun c ->
      Printf.printf "Available video encoder: %s - %s\n%!"
        (Avcodec.Video.get_name c)
        (Avcodec.Video.get_description c))
    Avcodec.Video.encoders;

  List.iter
    (fun c ->
      Printf.printf "Available video decoder: %s - %s\n%!"
        (Avcodec.Video.get_name c)
        (Avcodec.Video.get_description c))
    Avcodec.Video.decoders;

  Printf.printf "\n\n";

  Printf.printf "====== Subtitle ======\n%!";

  List.iter
    (fun id ->
      Printf.printf "Available subtitle codec: %s\nDescriptor:%s\n"
        (Avcodec.Subtitle.string_of_id id)
        (print_descriptor (Avcodec.Subtitle.descriptor id)))
    Avcodec.Subtitle.codec_ids;

  List.iter
    (fun c ->
      Printf.printf "Available subtitle encoder: %s - %s\n%!"
        (Avcodec.Subtitle.get_name c)
        (Avcodec.Subtitle.get_description c))
    Avcodec.Subtitle.encoders;

  List.iter
    (fun c ->
      Printf.printf "Available subtitle decoder: %s - %s\n%!"
        (Avcodec.Subtitle.get_name c)
        (Avcodec.Subtitle.get_description c))
    Avcodec.Subtitle.decoders