openharmony 鸿蒙 avcodec-support-formats

2025-06-12 浏览 (1)

AVCodec Supported Formats

Media Codec

Video Decoding

Currently, the following decoding capabilities are supported:

Video Hardware Decoding TypeVideo Software Decoding Type
AVC (H.264), HEVC (H.265)MPEG2, MPEG4, H.263, AVC (H.264)

Video software decoding and hardware decoding are different. When a decoder is created based on the MIME type, 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, and H.264 (OH_AVCODEC_MIMETYPE_VIDEO_AVC) and H.265 (OH_AVCODEC_MIMETYPE_VIDEO_HEVC) can be used for hardware decoding as long as they are supported by the hardware platform.

For details about the range of each decoding capability, see Obtaining Supported Codecs.

For details about the development guide, see Video Decoding.

Video Encoding

Currently, the following encoding capabilities are supported:

Video Encoding Type
HEVC (H.265), AVC (H.264)

Only 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.

For details about the range of each encoding capability, see Obtaining Supported Codecs.

For details about the development guide, see Video Encoding.

Audio Decoding

Currently, the following decoding capabilities are supported:

AAC, MPEG (MP3), FLAC, Vorbis, AMR (AMR-NB and AMR-WB), G.711Mu, APE

For details about the development guide, see Audio Decoding.

Audio Encoding

Currently, the following encoding capabilities are supported:

AAC, FLAC, MP3, G.711Mu

For details about the development guide, see Audio Encoding.

Media Data Multiplexing and Demultiplexing

Media Data Demultiplexing

The following formats are supported:

Media FormatContainer FormatStream Format
Audio/Videomp4Video stream: AVC (H.264) and MPEG4; audio stream: AAC and MPEG (MP3); subtitle stream: WEBVTT
Audio/Videofmp4Video stream: AVC (H.264); audio stream: AAC and MPEG (MP3)
Audio/VideomkvVideo stream: AVC (H.264); audio stream: AAC, MPEG (MP3), and OPUS
Audio/Videompeg-tsVideo stream: AVC (H.264), MPEG2, and MPEG4; audio stream: AAC and MPEG (MP3)
Audio/VideoflvVideo stream: AVC (H.264); audio stream: AAC
Audio/Videompeg-psVideo stream: AVC (H.264) and MPEG2; audio stream: MPEG (MP2 and MP3)
Audio/VideoaviVideo stream: H.263, AVC (H.264), MPEG2, and MPEG4; audio stream: AAC, MPEG (MP2 and MP3), and PCM
Audiom4aAudio stream: AAC
AudioaacAudio stream: AAC
Audiomp3Audio stream: MPEG (MP3)
AudiooggAudio stream: Vorbis
AudioflacAudio stream: FLAC
AudiowavAudio stream: PCM and G.711Mu
AudioamrAudio stream: AMR (AMR-NB and AMR-WB)
AudioapeAudio stream: APE
External subtitlesrtSubtitle stream: SRT
External subtitlewebvttSubtitle stream: WEBVTT

The DRM demultiplexing capability supports the following formats: mp4 (H.264 and AAC) and mpeg-ts (H.264 and AAC).

For details about the development guide, see Media Data Demultiplexing.

Media Data Multiplexing

Currently, the following muxer capabilities are supported:

Container FormatVideo Codec TypeAudio Codec TypeCover Type
mp4AVC (H.264) AAC, MPEG (MP3)jpeg, png, bmp
m4a-AACjpeg, png, bmp
mp3-MPEG (MP3)-
amr-AMR (AMR-NB and AMR-WB)-
wav-G711mu (pcm-mulaw)-
aac-AAC-

NOTE

  • 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.
  • 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.

Key values of configuration options are described as follows:

mp4 container format

keyDescriptionaacmp3H.264H.265jpgpngbmp
OH_MD_KEY_AUD_SAMPLE_RATESampling rateMandatoryMandatory-----
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channelsMandatoryMandatory-----
OH_MD_KEY_AUDIO_SAMPLE_FORMATOutput audio stream formatOptionalOptional-----
OH_MD_KEY_CHANNEL_LAYOUTChannel layoutOptionalOptional-----
OH_MD_KEY_PROFILEEncoding profileOptional------
OH_MD_KEY_BITRATEBit rateOptionalOptionalOptionalOptional---
OH_MD_KEY_CODEC_CONFIGCodec-specific dataOptional-OptionalOptional---
OH_MD_KEY_WIDTHWidth--MandatoryMandatoryMandatoryMandatoryMandatory
OH_MD_KEY_HEIGHTHeight--MandatoryMandatoryMandatoryMandatoryMandatory
OH_MD_KEY_FRAME_RATEVideo stream frame rate--OptionalOptional---
OH_MD_KEY_COLOR_PRIMARIESVideo color gamut--OptionalOptional---
OH_MD_KEY_TRANSFER_CHARACTERISTICSVideo transfer function--OptionalOptional---
OH_MD_KEY_MATRIX_COEFFICIENTSVideo matrix coefficient--OptionalOptional---
OH_MD_KEY_RANGE_FLAGValue range flag--OptionalOptional---
OH_MD_KEY_VIDEO_IS_HDR_VIVIDWhether the video track is an HDR Vivid---Optional---

m4a container format

keyDescriptionaacjpgpngbmp
OH_MD_KEY_AUD_SAMPLE_RATESampling rateMandatory---
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channelsMandatory---
OH_MD_KEY_AUDIO_SAMPLE_FORMATOutput audio stream formatOptional---
OH_MD_KEY_CHANNEL_LAYOUTChannel layoutOptional---
OH_MD_KEY_PROFILEEncoding profileOptional---
OH_MD_KEY_BITRATEBit rateOptional---
OH_MD_KEY_CODEC_CONFIGCodec-specific dataOptional---
OH_MD_KEY_WIDTHWidth-MandatoryMandatoryMandatory
OH_MD_KEY_HEIGHTHeight-MandatoryMandatoryMandatory

amr container format

keyDescriptionamr_nbamr_wb
OH_MD_KEY_AUD_SAMPLE_RATESampling rateMandatoryMandatory
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channelsMandatoryMandatory
OH_MD_KEY_AUDIO_SAMPLE_FORMATOutput audio stream formatOptionalOptional
OH_MD_KEY_CHANNEL_LAYOUTChannel layoutOptionalOptional
OH_MD_KEY_BITRATEBit rateOptionalOptional

mp3 container format

keyDescriptionmp3jpg
OH_MD_KEY_AUD_SAMPLE_RATESampling rateMandatory-
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channelsMandatory-
OH_MD_KEY_AUDIO_SAMPLE_FORMATOutput audio stream formatOptional-
OH_MD_KEY_CHANNEL_LAYOUTChannel layoutOptional-
OH_MD_KEY_BITRATEBit rateOptional-
OH_MD_KEY_WIDTHWidth-Mandatory
OH_MD_KEY_HEIGHTHeight-Mandatory

wav container format

keyDescriptiong711mu
OH_MD_KEY_AUD_SAMPLE_RATESampling rateMandatory
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channelsMandatory
OH_MD_KEY_AUDIO_SAMPLE_FORMATOutput audio stream formatOptional
OH_MD_KEY_CHANNEL_LAYOUTChannel layoutOptional
OH_MD_KEY_BITRATEBit rateMandatory

aac container format

keyDescriptionaac
OH_MD_KEY_AUD_SAMPLE_RATESampling rateMandatory
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channelsMandatory
OH_MD_KEY_AUDIO_SAMPLE_FORMATOutput audio stream formatOptional
OH_MD_KEY_CHANNEL_LAYOUTChannel layoutOptional
OH_MD_KEY_BITRATEBit rateOptional
OH_MD_KEY_PROFILEEncoding profileMandatory
OH_MD_KEY_AAC_IS_ADTSWhether the format is ADTSMandatory

For details about the development guide, see Media Data Multiplexing.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙AVCodec Kit

harmony 鸿蒙Audio Decoding

harmony 鸿蒙Audio Encoding

harmony 鸿蒙Media Data Demultiplexing

harmony 鸿蒙Media Data Multiplexing

harmony 鸿蒙Introduction to AVCodec Kit

harmony 鸿蒙Obtaining Supported Codecs

harmony 鸿蒙Concurrently Creating a Video Decoder and Initializing NativeWindow

harmony 鸿蒙Video Decoding

harmony 鸿蒙Video Encoding Configurations for Typical Scenarios

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/m0UrN5