mediaFormat QML Value Type
MediaFormat 描述媒体文件格式。更多
Import Statement: | import QtMultimedia |
属性
- audioCodec : enumeration
- fileFormat : enumeration
- videoCodec : enumeration
方法
- string audioCodecDescription(codec)
- string audioCodecName(codec)
- string fileFormatDescription(fileFormat)
- string fileFormatName(fileFormat)
- list<AudioCodec> supportedAudioFormats(conversionMode)
- list<FileFormat> supportedFileFormats(conversionMode)
- list<VideoCodec> supportedVideoCodecs(conversionMode)
- string videoCodecDescription(codec)
- string videoCodecName(codec)
详细说明
MediaFormat 类型描述媒体文件格式。它包含三个属性,分别描述文件类型以及使用的音频和视频编解码器。
MediaFormat 可用于指定MediaRecorder 应创建的文件类型。下面的代码段显示了一个示例,该示例设置刻录机创建带有 AAC 编码音频和 H265 视频的 mpeg4 视频:
CaptureSession { ... // setup inputs MediaRecorder { mediaFormat { fileFormat: MediaFormat.MPEG4 audioCodec: MediaFormat.AudioCodec.AAC videoCodec: MediaFormat.VideoCodec.H265 } } }
如果不支持指定的 mediaFormat,MediaRecorder 将自动尝试找到最佳的替代格式并使用它。
另请参阅 MediaRecorder 和CaptureSession 。
属性文档
audioCodec : enumeration |
描述多媒体文件或数据流中使用的音频编解码器。可使用以下值之一:
属性值 | 说明 |
---|---|
MediaFormat.WMA | Windows 媒体音频 |
MediaFormat.AC3 | 杜比数字 |
媒体格式.AAC | 高级音频编码 |
媒体格式.ALAC | 苹果无损音频编解码器 |
MediaFormat.DolbyTrueHD | 杜比 TrueHD |
MediaFormat.EAC3 | 杜比数字增强(EAC3) |
媒体格式.MP3 | MPEG-1 Audio Layer III 或 MPEG-2 Audio Layer III |
媒体格式.Wave | 波形音频文件格式 |
媒体格式.Vorbis | Ogg Vorbis |
媒体格式.FLAC | 免费无损音频编解码器 |
媒体格式.Opus | Opus 音频格式 |
MediaFormat.Unspecified | 未指定编解码器 |
fileFormat : enumeration |
描述多媒体文件或数据流中使用的容器格式。可使用以下值之一:
属性值 | 说明 |
---|---|
MediaFormat.WMA | Windows 媒体音频 |
媒体格式.AAC | 高级音频编码 |
媒体格式.Matroska | Matroska (MKV) |
媒体格式.WMV | Windows 媒体视频 |
媒体格式 MP3 | MPEG-1 Audio Layer III 或 MPEG-2 Audio Layer III |
媒体格式.Wave | 波形音频文件格式 |
媒体格式.Ogg | Ogg |
媒体格式.MPEG4 | MPEG-4 |
媒体格式.AVI | 音频视频交错 |
媒体格式.QuickTime | 音频视频交错 |
媒体格式.WebM | WebM |
媒体格式.Mpeg4Audio | MPEG-4 第 3 部分或 MPEG-4 音频(正式名称为 ISO/IEC 14496-3) |
媒体格式.FLAC | 免费无损音频编解码器 |
MediaFormat.UnspecifiedFormat 未指定格式 | 格式未指定。 |
videoCodec : enumeration |
描述多媒体文件或数据流中使用的视频编解码器。可使用以下值之一:
属性值 | 说明 |
---|---|
MediaFormat.VP8 | VP8 |
MediaFormat.MPEG2 | MPEG-2 |
MediaFormat.MPEG1 | MPEG-1 |
媒体格式.WMV | Windows 媒体视频 |
媒体格式.H265 | 高效视频编码(HEVC) |
媒体格式.H264 | 高级视频编码 |
媒体格式.MPEG4 | MPEG-4 |
媒体格式 AV1 | AOMedia视频1 |
媒体格式.MotionJPEG | MotionJPEG |
媒体格式.VP9 | VP9 |
MediaFormat.Theora | Theora |
媒体格式.未指定 | 未指定视频编解码器 |
方法文档
string audioCodecDescription(codec) |
返回codec 的描述。
string audioCodecName(codec) |
为codec 返回基于字符串的名称。
string fileFormatDescription(fileFormat) |
返回fileFormat 的描述。
string fileFormatName(fileFormat) |
返回fileFormat 的字符串名称。
list<AudioCodec> supportedAudioFormats(conversionMode) |
返回所选文件格式和视频编解码器的音频编解码器列表 (conversionMode)。
要获取所有支持的音频编解码器,请在默认构建的 MediaFormat 上运行此查询。要为文件格式和视频编解码器的特定组合获取支持的音频编解码器列表,可以在运行此查询之前设置fileFormat 和videoCodec 属性。
另请参阅 QMediaFormat::ConversionMode 。
list<FileFormat> supportedFileFormats(conversionMode) |
返回conversionMode 所指示的音频和视频编解码器的文件格式列表。
要获取所有支持的文件格式,请在默认构造的 MediaFormat 上运行此查询。要获取支持音频和视频编解码器特定组合的文件格式列表,可在运行此查询前设置audioCodec 和videoCodec 属性。
另请参阅 QMediaFormat::ConversionMode 。
list<VideoCodec> supportedVideoCodecs(conversionMode) |
返回所选文件格式和音频编解码器的视频编解码器列表 (conversionMode)。
要获取所有支持的视频编解码器,请在默认构建的 MediaFormat 上运行此查询。要为文件格式和音频编解码器的特定组合获取支持的视频编解码器列表,可以在运行此查询之前设置fileFormat 和audioCodec 属性。
另请参阅 QMediaFormat::ConversionMode 。
string videoCodecDescription(codec) |
返回codec 的描述。
string videoCodecName(codec) |
为codec 返回基于字符串的名称。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.