• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AVCodec Supported Formats
2
3## Media Codec
4
5### Video Decoding
6
7Currently, the following decoding capabilities are supported:
8
9| Video Hardware Decoding Type      | Video Software Decoding Type  |
10| --------------------- | ---------------- |
11| AVC (H.264) and HEVC (H.265)<!--RP14--><!--RP14End--> | AVC (H.264)<!--RP12--><!--RP12End--> |
12
13Video software decoding and hardware decoding are different. When a decoder is created based on the MIME type, <!--RP13-->only H.264 (OH_AVCODEC_MIMETYPE_VIDEO_AVC) is supported for software decoding, <!--RP13End--><!--RP15-->and H.264 (OH_AVCODEC_MIMETYPE_VIDEO_AVC) and H.265 (OH_AVCODEC_MIMETYPE_VIDEO_HEVC)<!--RP15End--> can be used for hardware decoding as long as they are supported by the hardware platform.
14
15For details about the range of each decoding capability, see [Obtaining Supported Codecs](obtain-supported-codecs.md).
16
17For details about the development guide, see [Video Decoding](video-decoding.md).
18
19### Video Encoding
20
21Currently, the following encoding capabilities are supported:
22
23| Video Encoding Type                |
24| ---------------------------- |
25| HEVC (H.265) and AVC (H.264)|
26
27Only hardware encoding is supported. When an encoder is created based on the MIME type, H.264 (OH_AVCODEC_MIMETYPE_VIDEO_AVC) and H.265 (OH_AVCODEC_MIMETYPE_VIDEO_HEVC) are supported.
28
29For details about the range of each encoding capability, see [Obtaining Supported Codecs](obtain-supported-codecs.md).
30
31For details about the development guide, see [Video Encoding](video-encoding.md).
32
33
34### Audio Decoding
35
36Currently, the following decoding capabilities are supported:
37
38| Container Format| Audio Decoding Type                |
39| -------- | :--------------------------- |
40| mp4      | AAC, MPEG (MP3), FLAC, Vorbis<!--RP1--><!--RP1End--> |
41| m4a      | AAC                          |
42| flac     | Flac                         |
43| ogg      | Vorbis<!--RP2--><!--RP2End-->    |
44| aac      | AAC                          |
45| mp3      | MPEG (MP3)                    |
46| amr      | AMR (AMR-NB and AMR-WB)           |
47| raw      | G711mu                       |
48| ape      | APE                          |
49
50For details about the development guide, see [Audio Decoding](audio-decoding.md).
51
52
53### Audio Encoding
54
55Currently, the following encoding capabilities are supported:
56
57| Container Format| Audio Encoding Type      |
58| -------- | :--------------- |
59| mp4      | AAC, FLAC       |
60| m4a      | AAC              |
61| flac     | Flac             |
62| aac      | AAC              |
63| mp3      | MP3              |
64| raw      | G711mu           |
65<!--RP3--><!--RP3End-->
66
67For details about the development guide, see [Audio Encoding](audio-encoding.md).
68
69
70## Media Data Muxing and Demuxing
71
72### Media Data Demuxing
73
74The following container formats are supported:
75
76| Media Format | Container Format                     | Stream Format                     |
77| -------- | :----------------------------| :----------------------------|
78| Audio/Video    | mp4                        |<!--RP4-->Video stream: AVC (H.264); audio stream: AAC and MPEG (MP3); subtitle stream: WEBVTT<!--RP4End-->|
79| Audio/Video    | fmp4                       |<!--RP5-->Video stream: AVC (H.264); audio stream: AAC and MPEG (MP3)<!--RP5End-->|
80| Audio/Video    | mkv                        |<!--RP6-->Video stream: AVC (H.264); audio stream: AAC, MPEG (MP3), and OPUS<!--RP6End-->|
81| Audio/Video    | mpeg-ts                    |<!--RP7-->Video stream: AVC (H.264); audio stream: AAC and MPEG (MP3)<!--RP7End-->|
82| Audio/Video    | flv                        |<!--RP8-->Video stream: AVC (H.264); audio stream: AAC<!--RP8End-->|
83| Audio      | m4a                        |<!--RP9-->Audio stream: AAC<!--RP9End-->|
84| Audio      | aac                        |Audio stream: AAC|
85| Audio      | mp3                        |Audio stream: MPEG (MP3)|
86| Audio      | ogg                        |Audio stream: OGG|
87| Audio      | flac                       |Audio stream: FLAC|
88| Audio      | wav                        |Audio stream: PCM and PCM-MULAW|
89| Audio      | amr                        |Audio stream: AMR (AMR-NB and AMR-WB)|
90| Audio      | ape                        |Audio stream: APE|
91| External subtitle  | srt                        |Subtitle stream: SRT|
92| External subtitle  | webvtt                     |Subtitle stream: WEBVTT|
93
94The DRM demuxing capability supports the following formats: <!--RP10-->mp4 (H.264 and AAC) and mpeg-ts (H.264 and AAC)<!--RP10End-->.
95
96For details about the development guide, see [Media Data Demuxing](audio-video-demuxer.md).
97
98
99### Media Data Muxing
100
101Currently, the following muxer capabilities are supported:
102
103| Container Format| Video Codec Type       | Audio Codec Type  | Cover Type      |
104| -------- | --------------------- | ---------------- | -------------- |
105| mp4      | AVC (H.264) <!--RP11--><!--RP11End-->    | AAC, MPEG (MP3)| jpeg, png, bmp|
106| m4a      | -                     | AAC              | jpeg, png, bmp|
107| mp3      | -                     | MPEG (MP3)     | -              |
108| amr      | -                     | AMR (AMR-NB and AMR-WB)| -             |
109| wav      | -                     | G711mu(pcm-mulaw) | -             |
110
111> **NOTE**
112>
113> - When the container format is MP4 and the audio codec type is MPEG (MP3), the sampling rate must be greater than or equal to 16000 Hz.
114> - When the container format is MP4 or M4A and the audio codec type is AAC, the number of audio channels ranges from 1 to 7.
115
116Key values of configuration options are described as follows:
117
118mp4 container format
119   |                key                 |         Description        |   aac  |   mp3  |  H.264  |  H.265  |  jpg   |  png   |  bmp   |
120   | ---------------------------------- | :------------------: | :----: | :----: | :----: | :----: | :----: | :----: | :----: |
121   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |  Mandatory |   -    |   -    |   -   |   -   |   -   |
122   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |  Mandatory |   -    |   -    |   -   |   -   |   -   |
123   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |  Optional |   -    |   -    |   -   |   -   |   -   |
124   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |  Optional |   -    |   -    |   -   |   -   |   -   |
125   | OH_MD_KEY_PROFILE                  | Encoding profile             |  Optional |   -   |   -    |   -    |   -   |   -   |   -   |
126   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |  Optional |  Optional |  Optional |   -   |   -   |   -   |
127   | OH_MD_KEY_CODEC_CONFIG             | Codec-specific data      |  Optional |   -   |  Optional |  Optional |   -   |   -   |   -   |
128   | OH_MD_KEY_WIDTH                    | Width                 |   -   |   -   |  Mandatory |  Mandatory |  Mandatory |  Mandatory |  Mandatory |
129   | OH_MD_KEY_HEIGHT                   | Height                 |   -   |   -   |  Mandatory |  Mandatory |  Mandatory |  Mandatory |  Mandatory |
130   | OH_MD_KEY_FRAME_RATE               | Video stream frame rate           |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
131   | OH_MD_KEY_COLOR_PRIMARIES          | Video color gamut             |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
132   | OH_MD_KEY_TRANSFER_CHARACTERISTICS | Video transfer function         |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
133   | OH_MD_KEY_MATRIX_COEFFICIENTS      | Video matrix coefficient         |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
134   | OH_MD_KEY_RANGE_FLAG               | Value range flag             |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
135   | OH_MD_KEY_VIDEO_IS_HDR_VIVID       | Whether the video track is an HDR Vivid|   -   |   -   |   -    |  Optional |   -   |   -   |   -   |
136
137m4a container format
138   |                key                 |         Description        |   aac  |  jpg   |  png   |  bmp   |
139   | ---------------------------------- | :------------------: | :----: | :----: | :----: | :----: |
140   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory  |   -   |   -   |   -   |
141   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory  |   -   |   -   |   -   |
142   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional  |   -   |   -   |   -   |
143   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional  |   -   |   -   |   -   |
144   | OH_MD_KEY_PROFILE                  | Encoding profile             |  Optional |   -   |   -   |   -   |
145   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional  |   -   |   -   |   -   |
146   | OH_MD_KEY_CODEC_CONFIG             | Codec-specific data      |  Optional |   -   |   -   |   -   |
147   | OH_MD_KEY_WIDTH                    | Width                 |   -   |  Mandatory |  Mandatory |  Mandatory |
148   | OH_MD_KEY_HEIGHT                   | Height                 |   -   |  Mandatory |  Mandatory |  Mandatory |
149
150amr container format
151   |                key                 |         Description        | amr_nb | amr_wb |
152   | ---------------------------------- | :------------------: | :----: | :----: |
153   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |  Mandatory |
154   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |  Mandatory |
155   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |  Optional |
156   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |  Optional |
157   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |  Optional |
158
159mp3 container format
160   |                key                 |         Description        |   mp3  |  jpg   |
161   | ---------------------------------- | :------------------: | :----: | :----: |
162   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |   -   |
163   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |   -   |
164   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |   -   |
165   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |   -   |
166   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |   -   |
167   | OH_MD_KEY_WIDTH                    | Width                 |   -   |  Mandatory |
168   | OH_MD_KEY_HEIGHT                   | Height                 |   -   |  Mandatory |
169
170wav container format
171   |                key                 |         Description        | g711mu  |
172   | ---------------------------------- | :------------------: | :----: |
173   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |
174   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |
175   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |
176   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |
177   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Mandatory |
178
179For details about the development guide, see [Media Data Muxing](audio-video-muxer.md).
180