PySide6.QtMultimedia.QMediaFormat¶
- class QMediaFormat¶
描述多媒体文件或流的编码格式。更多…
在版本6.1中添加。
概要¶
属性¶
audioCodecᅟ
- 媒体的音频编解码器fileFormatᅟ
- 媒体文件的(容器)格式videoCodecᅟ
- 媒体的视频编解码器
方法¶
def
__init__()
def
audioCodec()
def
fileFormat()
def
isSupported()
def
mimeType()
def
__ne__()
def
__eq__()
def
setAudioCodec()
def
setFileFormat()
def
setVideoCodec()
def
swap()
def
videoCodec()
静态函数¶
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
QMediaFormat
描述了一个多媒体文件或流的编码格式。您可以使用
QMediaFormat
来检查某种媒体格式是否可用于编码或解码。- class FileFormat¶
描述多媒体文件或流中使用的容器格式。
常量
描述
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
格式未指定。
- class AudioCodec¶
描述多媒体文件或流中使用的音频编解码器。
常量
描述
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
未指定的编解码器
- class VideoCodec¶
描述多媒体文件或流中使用的视频编码。
常量
描述
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
未指定视频编解码器
- class ConversionMode¶
在许多情况下,系统具有不对称的能力,通常可以解码比编码更多的格式或编解码器。此枚举描述了在检查是否支持某种文件格式或编解码器时使用的请求转换模式。
常量
描述
QMediaFormat.Encode
用于检查是否可以编码某种文件格式或编解码器。
QMediaFormat.Decode
用于检查是否可以解码某种文件格式或编解码器。
- class ResolveFlags¶
描述了为
QMediaRecorder
解析合适格式的要求。常量
描述
QMediaFormat.NoFlags
无要求
QMediaFormat.RequiresVideo
需要视频编解码器
另请参阅
注意
当使用
from __feature__ import true_property
时,属性可以直接使用,否则通过访问器函数使用。- property audioCodecᅟ: QMediaFormat.AudioCodec¶
此属性保存媒体的音频编解码器。
另请参阅
- Access functions:
- property fileFormatᅟ: QMediaFormat.FileFormat¶
此属性保存媒体的文件(容器)格式。
另请参阅
- Access functions:
- property videoCodecᅟ: QMediaFormat.VideoCodec¶
此属性保存媒体的视频编解码器。
另请参阅
- Access functions:
- PySide6.QtMultimedia.QMediaFormat.fmt¶
- PySide6.QtMultimedia.QMediaFormat.audio¶
- PySide6.QtMultimedia.QMediaFormat.video¶
- __init__([format=QMediaFormat.FileFormat.UnspecifiedFormat])¶
- Parameters:
格式 –
FileFormat
为
format
构造一个QMediaFormat
对象。- __init__(other)
- Parameters:
其他 –
QMediaFormat
通过从
other
复制来构造一个QMediaFormat
对象。- audioCodec()¶
- Return type:
返回此格式中使用的音频编解码器。
属性
audioCodecᅟ
的获取器。- static audioCodecDescription(codec)¶
- Parameters:
编解码器 –
AudioCodec
- Return type:
字符串
返回
codec
的描述。- static audioCodecName(codec)¶
- Parameters:
编解码器 –
AudioCodec
- Return type:
字符串
返回基于
codec
的字符串名称。- fileFormat()¶
- Return type:
另请参阅
属性
fileFormatᅟ
的获取器。- static fileFormatDescription(fileFormat)¶
- Parameters:
文件格式 –
FileFormat
- Return type:
字符串
返回
fileFormat
的描述。- static fileFormatName(fileFormat)¶
- Parameters:
文件格式 –
FileFormat
- Return type:
字符串
返回基于
fileFormat
的字符串名称。- isSupported(mode)¶
- Parameters:
mode –
ConversionMode
- Return type:
布尔
如果Qt Multimedia可以编码或解码此格式,则返回
true
,具体取决于mode
。返回用于此媒体格式的文件格式的MIME类型。
- __ne__(other)¶
- Parameters:
其他 –
QMediaFormat
- Return type:
布尔
如果
other
不等于当前的媒体格式,则返回true
,否则返回false
。- __eq__(other)¶
- Parameters:
其他 –
QMediaFormat
- Return type:
布尔
如果
other
等于当前媒体格式,则返回true
,否则返回false
。- resolveForEncoding(flags)¶
- Parameters:
flags –
ResolveFlags
根据
flags
解析格式,转换为QMediaRecorder
支持的格式。此方法尝试为未指定的设置找到最佳匹配。录音机不支持的设置将被修改为最接近的受支持匹配。
解析时,优先级按以下顺序确定:
文件格式
视频编解码器
音频编解码器
- setAudioCodec(codec)¶
- Parameters:
编解码器 –
AudioCodec
将音频编解码器设置为
codec
。另请参阅
属性
audioCodecᅟ
的设置器。- setFileFormat(f)¶
- Parameters:
f –
FileFormat
另请参阅
属性
fileFormatᅟ
的设置器。- setVideoCodec(codec)¶
- Parameters:
codec –
VideoCodec
将视频编解码器设置为
codec
。另请参阅
属性
videoCodecᅟ
的设置器。- supportedAudioCodecs(m)¶
- Parameters:
m –
ConversionMode
- Return type:
返回所选文件格式和视频编解码器(
m
)的音频编解码器列表。要获取所有支持的音频编解码器,请在默认构造的
QMediaFormat
上运行此查询。另请参阅
- supportedFileFormats(m)¶
- Parameters:
m –
ConversionMode
- Return type:
返回由
m
指示的音频和视频编解码器的文件格式列表。要获取所有支持的文件格式,请在默认构造的
QMediaFormat
上运行此查询。另请参阅
- supportedVideoCodecs(m)¶
- Parameters:
m –
ConversionMode
- Return type:
返回所选文件格式和音频编解码器(
m
)的视频编解码器列表。要获取所有支持的视频编解码器,请在默认构造的MediaFormat上运行此查询。
另请参阅
- swap(other)¶
- Parameters:
其他 –
QMediaFormat
将媒体格式与
other
交换。- videoCodec()¶
- Return type:
返回此格式中使用的视频编解码器。
属性
videoCodecᅟ
的获取器。- static videoCodecDescription(codec)¶
- Parameters:
codec –
VideoCodec
- Return type:
字符串
返回
codec
的描述。- static videoCodecName(codec)¶
- Parameters:
codec –
VideoCodec
- Return type:
字符串
返回基于
codec
的字符串名称。