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 .