QMediaFormat

Describes an encoding format for a multimedia file or stream. More

Inheritance diagram of PySide6.QtMultimedia.QMediaFormat

New in version 6.1.

Synopsis

Functions

Static functions

Detailed Description

QMediaFormat describes an encoding format for a multimedia file or stream.

You can check whether a certain media format can be used for encoding or decoding using QMediaFormat .

class PySide6.QtMultimedia.QMediaFormat([format=UnspecifiedFormat])

PySide6.QtMultimedia.QMediaFormat(other)

Parameters

Constructs a QMediaFormat object for format.

PySide6.QtMultimedia.QMediaFormat.FileFormat

Describes the container format used in a multimedia file or stream.

Constant

Description

QMediaFormat.WMA

Windows Media Audio

QMediaFormat.AAC

Advanced Audio Coding

QMediaFormat.Matroska

Matroska (MKV)

QMediaFormat.WMV

Windows Media Video

QMediaFormat.MP3

MPEG-1 Audio Layer III or MPEG-2 Audio Layer III

QMediaFormat.Wave

Waveform Audio File Format

QMediaFormat.Ogg

Ogg

QMediaFormat.MPEG4

MPEG-4

QMediaFormat.AVI

Audio Video Interleave

QMediaFormat.QuickTime

QuickTime

QMediaFormat.WebM

WebM

QMediaFormat.Mpeg4Audio

MPEG-4 Part 3 or MPEG-4 Audio (formally ISO/IEC 14496-3)

QMediaFormat.FLAC

Free Lossless Audio Codec

QMediaFormat.UnspecifiedFormat

The format is unspecified.

PySide6.QtMultimedia.QMediaFormat.AudioCodec

Describes the audio codec used in multimedia file or stream.

Constant

Description

QMediaFormat.AudioCodec.WMA

Windows Media Audio

QMediaFormat.AudioCodec.AC3

Dolby Digital

QMediaFormat.AudioCodec.AAC

Advanced Audio Coding

QMediaFormat.AudioCodec.ALAC

Apple Lossless Audio Codec

QMediaFormat.AudioCodec.DolbyTrueHD

Dolby TrueHD

QMediaFormat.AudioCodec.EAC3

Dolby Digital Plus (EAC3)

QMediaFormat.AudioCodec.MP3

MPEG-1 Audio Layer III or MPEG-2 Audio Layer III

QMediaFormat.AudioCodec.Wave

Waveform Audio File Format

QMediaFormat.AudioCodec.Vorbis

Ogg Vorbis

QMediaFormat.AudioCodec.FLAC

Free Lossless Audio Codec

QMediaFormat.AudioCodec.Opus

Opus Audio Format

QMediaFormat.AudioCodec.Unspecified

Unspecified codec

PySide6.QtMultimedia.QMediaFormat.VideoCodec

Describes the video coded used in multimedia file or stream.

Constant

Description

QMediaFormat.VideoCodec.VP8

VP8

QMediaFormat.VideoCodec.MPEG2

MPEG-2

QMediaFormat.VideoCodec.MPEG1

MPEG-1

QMediaFormat.VideoCodec.WMV

Windows Media Video

QMediaFormat.VideoCodec.H265

High Efficiency Video Coding (HEVC)

QMediaFormat.VideoCodec.H264

Advanced Video Coding

QMediaFormat.VideoCodec.MPEG4

MPEG-4

QMediaFormat.VideoCodec.AV1

AOMedia Video 1

QMediaFormat.VideoCodec.MotionJPEG

MotionJPEG

QMediaFormat.VideoCodec.VP9

VP9

QMediaFormat.VideoCodec.Theora

Theora

QMediaFormat.VideoCodec.Unspecified

Video codec not specified

PySide6.QtMultimedia.QMediaFormat.ConversionMode

In many cases, systems have asymmetric capabilities and can often decode more formats or codecs than can be encoded. This enum describes the requested conversion mode to be used when checking whether a certain file format or codec is supported.

Constant

Description

QMediaFormat.Encode

Used to check whether a certain file format or codec can be encoded.

QMediaFormat.Decode

Used to check whether a certain file format or codec can be decoded.

PySide6.QtMultimedia.QMediaFormat.ResolveFlags

Describes the requirements for resolving a suitable format for QMediaRecorder .

Constant

Description

QMediaFormat.NoFlags

No requirements

QMediaFormat.RequiresVideo

A video codec is required

PySide6.QtMultimedia.QMediaFormat.fmt
PySide6.QtMultimedia.QMediaFormat.audio
PySide6.QtMultimedia.QMediaFormat.video
PySide6.QtMultimedia.QMediaFormat.audioCodec()
Return type

AudioCodec

Returns the audio codec used in this format.

See also

setAudioCodec() AudioCodec

static PySide6.QtMultimedia.QMediaFormat.audioCodecDescription(codec)
Parameters

codecAudioCodec

Return type

str

Returns a description for codec.

static PySide6.QtMultimedia.QMediaFormat.audioCodecName(codec)
Parameters

codecAudioCodec

Return type

str

Returns a string based name for codec.

PySide6.QtMultimedia.QMediaFormat.fileFormat()
Return type

FileFormat

See also

setFileFormat()

static PySide6.QtMultimedia.QMediaFormat.fileFormatDescription(fileFormat)
Parameters

fileFormatFileFormat

Return type

str

Returns a description for fileFormat.

static PySide6.QtMultimedia.QMediaFormat.fileFormatName(fileFormat)
Parameters

fileFormatFileFormat

Return type

str

Returns a string based name for fileFormat.

PySide6.QtMultimedia.QMediaFormat.isSupported(mode)
Parameters

modeConversionMode

Return type

bool

Returns true if Qt Multimedia can encode or decode this format, depending on mode.

PySide6.QtMultimedia.QMediaFormat.mimeType()
Return type

PySide6.QtCore.QMimeType

Returns the MIME type for the file format used in this media format.

PySide6.QtMultimedia.QMediaFormat.__ne__(other)
Parameters

otherPySide6.QtMultimedia.QMediaFormat

Return type

bool

PySide6.QtMultimedia.QMediaFormat.__eq__(other)
Parameters

otherPySide6.QtMultimedia.QMediaFormat

Return type

bool

PySide6.QtMultimedia.QMediaFormat.resolveForEncoding(flags)
Parameters

flagsResolveFlags

Resolves the format, based on flags, to a format that is supported by QMediaRecorder .

This method tries to find the best possible match for unspecified settings. Settings that are not supported by the recorder will be modified to the closest match that is supported.

When resolving, priority is given in the following order:

  1. File format

  2. Video codec

  3. Audio codec

PySide6.QtMultimedia.QMediaFormat.setAudioCodec(codec)
Parameters

codecAudioCodec

Sets the audio codec to codec.

See also

audioCodec() AudioCodec

PySide6.QtMultimedia.QMediaFormat.setFileFormat(f)
Parameters

fFileFormat

See also

fileFormat()

PySide6.QtMultimedia.QMediaFormat.setVideoCodec(codec)
Parameters

codecVideoCodec

Sets the video codec to codec.

See also

videoCodec() VideoCodec

PySide6.QtMultimedia.QMediaFormat.supportedAudioCodecs(m)
Parameters

mConversionMode

Return type

Returns a list of audio codecs for the chosen file format and video codec (m).

To get all supported audio codecs, run this query on a default constructed QMediaFormat .

See also

ConversionMode

PySide6.QtMultimedia.QMediaFormat.supportedFileFormats(m)
Parameters

mConversionMode

Return type

Returns a list of file formats for the audio and video codec indicated by m.

To get all supported file formats, run this query on a default constructed QMediaFormat .

See also

ConversionMode

PySide6.QtMultimedia.QMediaFormat.supportedVideoCodecs(m)
Parameters

mConversionMode

Return type

Returns a list of video codecs for the chosen file format and audio codec (m).

To get all supported video codecs, run this query on a default constructed MediaFormat.

See also

ConversionMode

PySide6.QtMultimedia.QMediaFormat.swap(other)
Parameters

otherPySide6.QtMultimedia.QMediaFormat

PySide6.QtMultimedia.QMediaFormat.videoCodec()
Return type

VideoCodec

Returns the video codec used in this format.

See also

setVideoCodec() VideoCodec

static PySide6.QtMultimedia.QMediaFormat.videoCodecDescription(codec)
Parameters

codecVideoCodec

Return type

str

Returns a description for codec.

static PySide6.QtMultimedia.QMediaFormat.videoCodecName(codec)
Parameters

codecVideoCodec

Return type

str

Returns a string based name for codec.