mediaFormat QML Value Type

MediaFormat describes the format of a media file. More...

Import Statement: import QtMultimedia

Properties

Methods

Detailed Description

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.

See also MediaRecorder and CaptureSession.

Property Documentation

audioCodec : enumeration

Describes the audio codec used in multimedia file or stream. It can take one of the following values:

Property valueDescription
MediaFormat.WMAWindows Media Audio
MediaFormat.AC3Dolby Digital
MediaFormat.AACAdvanced Audio Coding
MediaFormat.ALACApple Lossless Audio Codec
MediaFormat.DolbyTrueHDDolby TrueHD
MediaFormat.EAC3Dolby Digital Plus (EAC3)
MediaFormat.MP3MPEG-1 Audio Layer III or MPEG-2 Audio Layer III
MediaFormat.WaveWaveform Audio File Format
MediaFormat.VorbisOgg Vorbis
MediaFormat.FLACFree Lossless Audio Codec
MediaFormat.OpusOpus Audio Format
MediaFormat.UnspecifiedUnspecified codec

fileFormat : enumeration

Describes the container format used in a multimedia file or stream. It can take one of the following values:

Property valueDescription
MediaFormat.WMAWindows Media Audio
MediaFormat.AACAdvanced Audio Coding
MediaFormat.MatroskaMatroska (MKV)
MediaFormat.WMVWindows Media Video
MediaFormat.MP3MPEG-1 Audio Layer III or MPEG-2 Audio Layer III
MediaFormat.WaveWaveform Audio File Format
MediaFormat.OggOgg
MediaFormat.MPEG4MPEG-4
MediaFormat.AVIAudio Video Interleave
MediaFormat.QuickTimeQuickTime
MediaFormat.WebMWebM
MediaFormat.Mpeg4AudioMPEG-4 Part 3 or MPEG-4 Audio (formally ISO/IEC 14496-3)
MediaFormat.FLACFree Lossless Audio Codec
MediaFormat.UnspecifiedFormatThe format is unspecified.

videoCodec : enumeration

Describes the video codec used in multimedia file or stream. It can take one of the following values:

Property valueDescription
MediaFormat.VP8VP8
MediaFormat.MPEG2MPEG-2
MediaFormat.MPEG1MPEG-1
MediaFormat.WMVWindows Media Video
MediaFormat.H265High Efficiency Video Coding (HEVC)
MediaFormat.H264Advanced Video Coding
MediaFormat.MPEG4MPEG-4
MediaFormat.AV1AOMedia Video 1
MediaFormat.MotionJPEGMotionJPEG
MediaFormat.VP9VP9
MediaFormat.TheoraTheora
MediaFormat.UnspecifiedVideo codec not specified

Method Documentation

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.

See also 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.

See also 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.

See also QMediaFormat::ConversionMode.


string videoCodecDescription(codec)

Returns a description for codec.


string videoCodecName(codec)

Returns a string based name for codec.


© 2023 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.