PySide6.QtMultimedia.QMediaFormat¶
- class QMediaFormat¶
- Describes an encoding format for a multimedia file or stream. More… - Added in version 6.1. - Synopsis¶- Properties¶- audioCodecᅟ- Audio codec of the media
- fileFormatᅟ- File (container) format of the media
- videoCodecᅟ- Video codec of the media
 - Methods¶- def - __init__()
- def - audioCodec()
- def - fileFormat()
- def - isSupported()
- def - mimeType()
- def - __ne__()
- def - __eq__()
- def - setAudioCodec()
- def - setFileFormat()
- def - setVideoCodec()
- def - swap()
- def - videoCodec()
 - 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¶- QMediaFormatdescribes 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 - QMediaFormat.AAC - QMediaFormat.Matroska - QMediaFormat.WMV - QMediaFormat.MP3 - QMediaFormat.Wave - QMediaFormat.Ogg - QMediaFormat.MPEG4 - QMediaFormat.AVI - QMediaFormat.QuickTime - QMediaFormat.WebM - QMediaFormat.Mpeg4Audio - QMediaFormat.FLAC - QMediaFormat.UnspecifiedFormat - The format is unspecified. 
 - class AudioCodec¶
- Describes the audio codec used in multimedia file or stream. - Constant - Description - QMediaFormat.AudioCodec.WMA - QMediaFormat.AudioCodec.AC3 - QMediaFormat.AudioCodec.AAC - QMediaFormat.AudioCodec.ALAC - QMediaFormat.AudioCodec.DolbyTrueHD - QMediaFormat.AudioCodec.EAC3 - QMediaFormat.AudioCodec.MP3 - QMediaFormat.AudioCodec.Wave - QMediaFormat.AudioCodec.Vorbis - QMediaFormat.AudioCodec.FLAC - QMediaFormat.AudioCodec.Opus - QMediaFormat.AudioCodec.Unspecified - Unspecified codec 
 - class VideoCodec¶
- Describes the video coded used in multimedia file or stream. - Constant - Description - QMediaFormat.VideoCodec.VP8 - QMediaFormat.VideoCodec.MPEG2 - QMediaFormat.VideoCodec.MPEG1 - QMediaFormat.VideoCodec.WMV - QMediaFormat.VideoCodec.H265 - QMediaFormat.VideoCodec.H264 - QMediaFormat.VideoCodec.MPEG4 - QMediaFormat.VideoCodec.AV1 - QMediaFormat.VideoCodec.MotionJPEG - QMediaFormat.VideoCodec.VP9 - QMediaFormat.VideoCodec.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 - See also 
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property audioCodecᅟ: QMediaFormat.AudioCodec¶
 - This property holds The audio codec of the media.. - See also - Access functions:
 - property fileFormatᅟ: QMediaFormat.FileFormat¶
 - This property holds The file (container) format of the media.. - See also - Access functions:
 - property videoCodecᅟ: QMediaFormat.VideoCodec¶
 - This property holds The video codec of the media.. - See also - Access functions:
 - PySide6.QtMultimedia.QMediaFormat.fmt¶
 - PySide6.QtMultimedia.QMediaFormat.audio¶
 - PySide6.QtMultimedia.QMediaFormat.video¶
 - __init__([format=QMediaFormat.FileFormat.UnspecifiedFormat])¶
- Parameters:
- format – - FileFormat
 
 - Constructs a - QMediaFormatobject for- format.- __init__(other)
- Parameters:
- other – - QMediaFormat
 
 - Constructs a - QMediaFormatobject by copying from- other.- audioCodec()¶
- Return type:
 
 - Returns the audio codec used in this format. - See also - Getter of property - audioCodecᅟ.- static audioCodecDescription(codec)¶
- Parameters:
- codec – - AudioCodec
- Return type:
- str 
 
 - Returns a description for - codec.- static audioCodecName(codec)¶
- Parameters:
- codec – - AudioCodec
- Return type:
- str 
 
 - Returns a string based name for - codec.- fileFormat()¶
- Return type:
 - See also 
 - Getter of property - fileFormatᅟ.- static fileFormatDescription(fileFormat)¶
- Parameters:
- fileFormat – - FileFormat
- Return type:
- str 
 
 - Returns a description for - fileFormat.- static fileFormatName(fileFormat)¶
- Parameters:
- fileFormat – - FileFormat
- Return type:
- str 
 
 - Returns a string based name for - fileFormat.- isSupported(mode)¶
- Parameters:
- mode – - ConversionMode
- Return type:
- bool 
 
 - Returns - trueif Qt Multimedia can encode or decode this format, depending on- mode.- Returns the MIME type for the file format used in this media format. - __ne__(other)¶
- Parameters:
- other – - QMediaFormat
- Return type:
- bool 
 
 - Returns - trueif- otheris not equal to the current media format, otherwise returns- false.- __eq__(other)¶
- Parameters:
- other – - QMediaFormat
- Return type:
- bool 
 
 - Returns - trueif- otheris equal to the current media format, otherwise returns- false.- resolveForEncoding(flags)¶
- Parameters:
- flags – - ResolveFlags
 
 - 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: - File format 
- Video codec 
- Audio codec 
 - setAudioCodec(codec)¶
- Parameters:
- codec – - AudioCodec
 
 - Sets the audio codec to - codec.- See also - Setter of property - audioCodecᅟ.- setFileFormat(f)¶
- Parameters:
- f – - FileFormat
 - See also 
 - Setter of property - fileFormatᅟ.- setVideoCodec(codec)¶
- Parameters:
- codec – - VideoCodec
 
 - Sets the video codec to - codec.- See also - Setter of property - videoCodecᅟ.- supportedAudioCodecs(m)¶
- Parameters:
- m – - ConversionMode
- 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 - supportedFileFormats(m)¶
- Parameters:
- m – - ConversionMode
- 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 - supportedVideoCodecs(m)¶
- Parameters:
- m – - ConversionMode
- 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 - swap(other)¶
- Parameters:
- other – - QMediaFormat
 
 - Swaps the media format with - other.- videoCodec()¶
- Return type:
 
 - Returns the video codec used in this format. - See also - Getter of property - videoCodecᅟ.- static videoCodecDescription(codec)¶
- Parameters:
- codec – - VideoCodec
- Return type:
- str 
 
 - Returns a description for - codec.- static videoCodecName(codec)¶
- Parameters:
- codec – - VideoCodec
- Return type:
- str 
 
 - Returns a string based name for - codec.