MediaFormat describes the format of a media file. 更多...
import 语句: | import QtMultimedia |
The MediaFormat type describes the format of a media file. It contains three properties that describe the file type and the audio and video codecs that are being used.
MediaFormat can be used to specify the type of file that should be created by a MediaRecorder . The snippet below shows an example that sets up the recorder to create an mpeg4 video with AAC encoded audio and H265 video:
CaptureSession { ... // setup inputs MediaRecorder { mediaFormat { fileFormat: MediaFormat.MPEG4 audioCodec: MediaFormat.AudioCodec.AAC videoCodec: MediaFormat.VideoCodec.H265 } } }
If the specified mediaFormat is not supported, the MediaRecorder will automatically try to find the best possible replacement format and use that instead.
另请参阅 MediaRecorder and CaptureSession .
audioCodec : enumeration |
Describes the audio codec used in multimedia file or stream. It can take one of the following values:
Property value | 描述 |
---|---|
MediaFormat.WMA | WMA (Windows 媒体音频) |
MediaFormat.AC3 | 杜比数字 |
MediaFormat.AAC | AAC (高级音频编码) |
MediaFormat.ALAC | ALAC (Apple 无损音频编解码器) |
MediaFormat.DolbyTrueHD | 杜比 TrueHD |
MediaFormat.EAC3 | 杜比数字 + (EAC3) |
MediaFormat.MP3 | MPEG-1 音频层 III (或 MPEG-2 音频层 III) |
MediaFormat.Wave | 波形音频文件格式 |
MediaFormat.Vorbis | Ogg Vorbis |
MediaFormat.FLAC | FLAC (自由无损音频编解码器) |
MediaFormat.Opus | Opus 音频格式 |
MediaFormat.Unspecified | 未指定编解码器 |
fileFormat : enumeration |
Describes the container format used in a multimedia file or stream. It can take one of the following values:
Property value | 描述 |
---|---|
MediaFormat.WMA | WMA (Windows 媒体音频) |
MediaFormat.AAC | AAC (高级音频编码) |
MediaFormat.Matroska | Matroska (MKV) |
MediaFormat.WMV | WMV (Windows 媒体视频) |
MediaFormat.MP3 | MPEG-1 音频层 III (或 MPEG-2 音频层 III) |
MediaFormat.Wave | 波形音频文件格式 |
MediaFormat.Ogg | Ogg |
MediaFormat.MPEG4 | MPEG-4 |
MediaFormat.AVI | AVI (音频视频交错) |
MediaFormat.QuickTime | QuickTime |
MediaFormat.WebM | WebM |
MediaFormat.Mpeg4Audio | MPEG-4 第 3 部分或 MPEG-4 音频 (正式 ISO/IEC 14496-3) |
MediaFormat.FLAC | FLAC (自由无损音频编解码器) |
MediaFormat.UnspecifiedFormat | The format is unspecified. |
videoCodec : enumeration |
Describes the video codec used in multimedia file or stream. It can take one of the following values:
Property value | 描述 |
---|---|
MediaFormat.VP8 | VP8 |
MediaFormat.MPEG2 | MPEG-2 |
MediaFormat.MPEG1 | MPEG-1 |
MediaFormat.WMV | WMV (Windows 媒体视频) |
MediaFormat.H265 | High Efficiency Video Coding (HEVC) |
MediaFormat.H264 | Advanced Video Coding |
MediaFormat.MPEG4 | MPEG-4 |
MediaFormat.AV1 | AOMedia Video 1 |
MediaFormat.MotionJPEG | MotionJPEG |
MediaFormat.VP9 | VP9 |
MediaFormat.Theora | Theora |
MediaFormat.Unspecified | Video codec not specified |
string audioCodecDescription ( codec ) |
Returns a description for codec .
string audioCodecName ( codec ) |
Returns a string based name for codec .
string fileFormatDescription ( fileFormat ) |
Returns a description for fileFormat .
string fileFormatName ( fileFormat ) |
Returns a string based name for fileFormat .
list < AudioCodec > supportedAudioFormats ( conversionMode ) |
Returns a list of audio codecs for the chosen file format and video codec ( conversionMode ).
To get all supported audio codecs, run this query on a default constructed MediaFormat. To get a list of supported audio codecs for a specific combination of a file format and a video codec, you can set the fileFormat and videoCodec properties before running this query.
另请参阅 QMediaFormat::ConversionMode .
list < FileFormat > supportedFileFormats ( conversionMode ) |
Returns a list of file formats for the audio and video codec indicated by conversionMode .
To get all supported file formats, run this query on a default constructed MediaFormat. To get a list of file formats supporting a specific combination of an audio and video codec, you can set the audioCodec and videoCodec properties before running this query.
另请参阅 QMediaFormat::ConversionMode .
list < VideoCodec > supportedVideoCodecs ( conversionMode ) |
Returns a list of video codecs for the chosen file format and audio codec ( conversionMode ).
To get all supported video codecs, run this query on a default constructed MediaFormat. To get a list of supported video codecs for a specific combination of a file format and an audio codec, you can set the fileFormat and audioCodec properties before running this query.
另请参阅 QMediaFormat::ConversionMode .
string videoCodecDescription ( codec ) |
Returns a description for codec .
string videoCodecName ( codec ) |
Returns a string based name for codec .