class QMediaFormat#

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

New in version 6.1.

Synopsis#

Properties#

Methods#

Static functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

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

class 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

class 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

class 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.

class ResolveFlags#

Describes the requirements for resolving a suitable format for QMediaRecorder .

Constant

Description

QMediaFormat.NoFlags

No requirements

QMediaFormat.RequiresVideo

A video codec is required

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property audioCodecᅟ: QMediaFormat.AudioCodec#

This property holds The audio codec of the media..

See also

AudioCodec

Access functions:
property fileFormatᅟ: QMediaFormat.FileFormat#

This property holds The file (container) format of the media..

See also

FileFormat

Access functions:
property videoCodecᅟ: QMediaFormat.VideoCodec#

This property holds The video codec of the media..

See also

VideoCodec

Access functions:
PySide6.QtMultimedia.QMediaFormat.fmt#
PySide6.QtMultimedia.QMediaFormat.audio#
PySide6.QtMultimedia.QMediaFormat.video#
__init__(other)#
Parameters:

otherQMediaFormat

Constructs a QMediaFormat object by copying from other.

__init__([format=QMediaFormat.FileFormat.UnspecifiedFormat])
Parameters:

formatFileFormat

Constructs a QMediaFormat object for format.

audioCodec()#
Return type:

AudioCodec

Returns the audio codec used in this format.

Getter of property audioCodecᅟ .

static audioCodecDescription(codec)#
Parameters:

codecAudioCodec

Return type:

str

Returns a description for codec.

static audioCodecName(codec)#
Parameters:

codecAudioCodec

Return type:

str

Returns a string based name for codec.

fileFormat()#
Return type:

FileFormat

See also

setFileFormat()

Getter of property fileFormatᅟ .

static fileFormatDescription(fileFormat)#
Parameters:

fileFormatFileFormat

Return type:

str

Returns a description for fileFormat.

static fileFormatName(fileFormat)#
Parameters:

fileFormatFileFormat

Return type:

str

Returns a string based name for fileFormat.

isSupported(mode)#
Parameters:

modeConversionMode

Return type:

bool

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

mimeType()#
Return type:

QMimeType

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

__ne__(other)#
Parameters:

otherQMediaFormat

Return type:

bool

Returns true if other is not equal to the current media format, otherwise returns false.

__eq__(other)#
Parameters:

otherQMediaFormat

Return type:

bool

Returns true if other is equal to the current media format, otherwise returns false.

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

setAudioCodec(codec)#
Parameters:

codecAudioCodec

Sets the audio codec to codec.

Setter of property audioCodecᅟ .

setFileFormat(f)#
Parameters:

fFileFormat

See also

fileFormat()

Setter of property fileFormatᅟ .

setVideoCodec(codec)#
Parameters:

codecVideoCodec

Sets the video codec to codec.

Setter of property videoCodecᅟ .

supportedAudioCodecs(m)#
Parameters:

mConversionMode

Return type:

.list of QMediaFormat.AudioCodec

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

supportedFileFormats(m)#
Parameters:

mConversionMode

Return type:

.list of QMediaFormat.FileFormat

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

supportedVideoCodecs(m)#
Parameters:

mConversionMode

Return type:

.list of QMediaFormat.VideoCodec

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

swap(other)#
Parameters:

otherQMediaFormat

Swaps the media format with other.

videoCodec()#
Return type:

VideoCodec

Returns the video codec used in this format.

Getter of property videoCodecᅟ .

static videoCodecDescription(codec)#
Parameters:

codecVideoCodec

Return type:

str

Returns a description for codec.

static videoCodecName(codec)#
Parameters:

codecVideoCodec

Return type:

str

Returns a string based name for codec.