• 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), HEVC (H.265)<!--RP14--><!--RP14End--> | MPEG2, MPEG4, H.263, 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 MPEG2 (OH_AVCODEC_MIMETYPE_VIDEO_MPEG2), MPEG4 (OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2), H.263 (OH_AVCODEC_MIMETYPE_VIDEO_H263), and H.264 (OH_AVCODEC_MIMETYPE_VIDEO_AVC) are 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), 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
38AAC, MPEG (MP3), FLAC, Vorbis, AMR (AMR-NB and AMR-WB), G.711Mu, APE<!--RP1--><!--RP1End-->
39
40For details about the development guide, see [Audio Decoding](audio-decoding.md).
41
42
43### Audio Encoding
44
45Currently, the following encoding capabilities are supported:
46
47AAC, FLAC, MP3, G.711Mu<!--RP3--><!--RP3End-->
48
49For details about the development guide, see [Audio Encoding](audio-encoding.md).
50
51
52## Media Data Multiplexing and Demultiplexing
53
54### Media Data Demultiplexing
55
56The following formats are supported:
57
58| Media Format | Container Format                     | Stream Format                     |
59| -------- | :----------------------------| :----------------------------|
60| Audio/Video    | mp4                        |<!--RP4-->Video stream: AVC (H.264) and MPEG4; audio stream: AAC and MPEG (MP3); subtitle stream: WEBVTT<!--RP4End-->|
61| Audio/Video    | fmp4                       |<!--RP5-->Video stream: AVC (H.264); audio stream: AAC and MPEG (MP3)<!--RP5End-->|
62| Audio/Video    | mkv                        |<!--RP6-->Video stream: AVC (H.264); audio stream: AAC, MPEG (MP3), and OPUS<!--RP6End-->|
63| Audio/Video    | mpeg-ts                    |<!--RP7-->Video stream: AVC (H.264), MPEG2, and MPEG4; audio stream: AAC and MPEG (MP3)<!--RP7End-->|
64| Audio/Video    | flv                        |<!--RP8-->Video stream: AVC (H.264); audio stream: AAC<!--RP8End-->|
65| Audio/Video    | mpeg-ps                    |Video stream: AVC (H.264) and MPEG2; audio stream: MPEG (MP2 and MP3)|
66| Audio/Video    | avi                        |Video stream: H.263, AVC (H.264), MPEG2, and MPEG4; audio stream: AAC, MPEG (MP2 and MP3), and PCM|
67| Audio      | m4a                        |<!--RP9-->Audio stream: AAC<!--RP9End-->|
68| Audio      | aac                        |Audio stream: AAC|
69| Audio      | mp3                        |Audio stream: MPEG (MP3)|
70| Audio      | ogg                        |Audio stream: Vorbis|
71| Audio      | flac                       |Audio stream: FLAC|
72| Audio      | wav                        |Audio stream: PCM and G.711Mu|
73| Audio      | amr                        |Audio stream: AMR (AMR-NB and AMR-WB)|
74| Audio      | ape                        |Audio stream: APE|
75| External subtitle  | srt                        |Subtitle stream: SRT|
76| External subtitle  | webvtt                     |Subtitle stream: WEBVTT|
77
78The DRM demultiplexing capability supports the following formats: <!--RP10-->mp4 (H.264 and AAC) and mpeg-ts (H.264 and AAC)<!--RP10End-->.
79
80For details about the development guide, see [Media Data Demultiplexing](audio-video-demuxer.md).
81
82
83### Media Data Multiplexing
84
85Currently, the following muxer capabilities are supported:
86
87| Container Format| Video Codec Type       | Audio Codec Type  | Cover Type      |
88| -------- | --------------------- | ---------------- | -------------- |
89| mp4      | AVC (H.264) <!--RP11--><!--RP11End-->    | AAC, MPEG (MP3)| jpeg, png, bmp|
90| m4a      | -                     | AAC              | jpeg, png, bmp|
91| mp3      | -                     | MPEG (MP3)     | -              |
92| amr      | -                     | AMR (AMR-NB and AMR-WB)| -             |
93| wav      | -                     | G711mu (pcm-mulaw)| -             |
94| aac      | -                     | AAC               | -             |
95
96> **NOTE**
97>
98> - 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.
99> - 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.
100
101Key values of configuration options are described as follows:
102
103mp4 container format
104   |                key                 |         Description        |   aac  |   mp3  |  H.264  |  H.265  |  jpg   |  png   |  bmp   |
105   | ---------------------------------- | :------------------: | :----: | :----: | :----: | :----: | :----: | :----: | :----: |
106   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |  Mandatory |   -    |   -    |   -   |   -   |   -   |
107   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |  Mandatory |   -    |   -    |   -   |   -   |   -   |
108   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |  Optional |   -    |   -    |   -   |   -   |   -   |
109   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |  Optional |   -    |   -    |   -   |   -   |   -   |
110   | OH_MD_KEY_PROFILE                  | Encoding profile             |  Optional |   -   |   -    |   -    |   -   |   -   |   -   |
111   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |  Optional |  Optional |  Optional |   -   |   -   |   -   |
112   | OH_MD_KEY_CODEC_CONFIG             | Codec-specific data      |  Optional |   -   |  Optional |  Optional |   -   |   -   |   -   |
113   | OH_MD_KEY_WIDTH                    | Width                 |   -   |   -   |  Mandatory |  Mandatory |  Mandatory |  Mandatory |  Mandatory |
114   | OH_MD_KEY_HEIGHT                   | Height                 |   -   |   -   |  Mandatory |  Mandatory |  Mandatory |  Mandatory |  Mandatory |
115   | OH_MD_KEY_FRAME_RATE               | Video stream frame rate           |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
116   | OH_MD_KEY_COLOR_PRIMARIES          | Video color gamut             |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
117   | OH_MD_KEY_TRANSFER_CHARACTERISTICS | Video transfer function         |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
118   | OH_MD_KEY_MATRIX_COEFFICIENTS      | Video matrix coefficient         |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
119   | OH_MD_KEY_RANGE_FLAG               | Value range flag             |   -   |   -   |  Optional |  Optional |   -   |   -   |   -   |
120   | OH_MD_KEY_VIDEO_IS_HDR_VIVID       | Whether the video track is an HDR Vivid|   -   |   -   |   -    |  Optional |   -   |   -   |   -   |
121
122m4a container format
123   |                key                 |         Description        |   aac  |  jpg   |  png   |  bmp   |
124   | ---------------------------------- | :------------------: | :----: | :----: | :----: | :----: |
125   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory  |   -   |   -   |   -   |
126   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory  |   -   |   -   |   -   |
127   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional  |   -   |   -   |   -   |
128   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional  |   -   |   -   |   -   |
129   | OH_MD_KEY_PROFILE                  | Encoding profile             |  Optional |   -   |   -   |   -   |
130   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional  |   -   |   -   |   -   |
131   | OH_MD_KEY_CODEC_CONFIG             | Codec-specific data      |  Optional |   -   |   -   |   -   |
132   | OH_MD_KEY_WIDTH                    | Width                 |   -   |  Mandatory |  Mandatory |  Mandatory |
133   | OH_MD_KEY_HEIGHT                   | Height                 |   -   |  Mandatory |  Mandatory |  Mandatory |
134
135amr container format
136   |                key                 |         Description        | amr_nb | amr_wb |
137   | ---------------------------------- | :------------------: | :----: | :----: |
138   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |  Mandatory |
139   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |  Mandatory |
140   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |  Optional |
141   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |  Optional |
142   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |  Optional |
143
144mp3 container format
145   |                key                 |         Description        |   mp3  |  jpg   |
146   | ---------------------------------- | :------------------: | :----: | :----: |
147   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |   -   |
148   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |   -   |
149   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |   -   |
150   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |   -   |
151   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |   -   |
152   | OH_MD_KEY_WIDTH                    | Width                 |   -   |  Mandatory |
153   | OH_MD_KEY_HEIGHT                   | Height                 |   -   |  Mandatory |
154
155wav container format
156   |                key                 |         Description        | g711mu  |
157   | ---------------------------------- | :------------------: | :----: |
158   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |
159   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |
160   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |
161   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |
162   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Mandatory |
163
164aac container format
165   |                key                 |         Description        |  aac   |
166   | ---------------------------------- | :------------------: | :----: |
167   | OH_MD_KEY_AUD_SAMPLE_RATE          | Sampling rate               |  Mandatory |
168   | OH_MD_KEY_AUD_CHANNEL_COUNT        | Number of audio channels               |  Mandatory |
169   | OH_MD_KEY_AUDIO_SAMPLE_FORMAT      | Output audio stream format        |  Optional |
170   | OH_MD_KEY_CHANNEL_LAYOUT           | Channel layout             |  Optional |
171   | OH_MD_KEY_BITRATE                  | Bit rate                 |  Optional |
172   | OH_MD_KEY_PROFILE                  | Encoding profile             |  Mandatory |
173   | OH_MD_KEY_AAC_IS_ADTS              | Whether the format is ADTS       |  Mandatory |
174
175For details about the development guide, see [Media Data Multiplexing](audio-video-muxer.md).
176