PySide6.QtMultimedia.QMediaCaptureSession¶
- class QMediaCaptureSession¶
QMediaCaptureSession类允许捕获音频和视频内容。更多…在版本6.1中添加。
概要¶
属性¶
audioBufferInputᅟ- 用于向QMediaRecorder发送自定义音频缓冲区的对象cameraᅟ- 用于捕捉视频imageCaptureᅟ- 用于捕捉静态图像的对象recorderᅟ- 用于捕获音频/视频的对象screenCaptureᅟ- 用于捕获屏幕的对象videoFrameInputᅟ- 用于向QMediaRecorder或视频输出发送自定义视频帧的对象windowCaptureᅟ- 用于捕获窗口的对象
方法¶
def
__init__()def
audioInput()def
audioOutput()def
camera()def
imageCapture()def
recorder()def
screenCapture()def
setAudioInput()def
setAudioOutput()def
setCamera()def
setRecorder()def
setVideoOutput()def
setVideoSink()def
videoOutput()def
videoSink()def
windowCapture()
信号¶
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
QMediaCaptureSession是管理本地设备上媒体捕获的核心类。您可以使用
setCamera()、setScreenCapture()、setWindowCapture()或setVideoFrameInput()将视频输入连接到QMediaCaptureSession。通过使用setVideoOutput()设置QVideoWidget或QGraphicsVideoItem,可以查看捕获媒体的预览。您可以使用
setAudioInput()将麦克风连接到QMediaCaptureSession,或者使用setAudioBufferInput()设置自定义音频输入。通过使用setAudioOutput()将音频路由到输出设备,可以听到捕获的声音。你可以通过在捕获会话上设置一个
QImageCapture对象来从相机捕获静态图像,并使用QMediaRecorder录制音频/视频。注意
当使用
from __feature__ import true_property时,属性可以直接使用,否则通过访问器函数使用。- property audioBufferInputᅟ: QAudioBufferInput¶
此属性保存用于将自定义音频缓冲区发送到
QMediaRecorder的对象。- Access functions:
- property audioInputᅟ: QAudioInput¶
返回用于捕获音频的设备。
- Access functions:
- property audioOutputᅟ: QAudioOutput¶
返回会话的音频输出。
- Access functions:
此属性保存用于捕获视频的相机。
通过使用此属性将相机添加到捕获会话中来录制视频或拍摄图像。
- Access functions:
- property imageCaptureᅟ: QImageCapture¶
此属性保存用于捕获静态图像的对象。
添加一个
QImageCapture对象到捕获会话中,以启用从相机捕获静态图像的功能。- Access functions:
- property recorderᅟ: QMediaRecorder¶
此属性保存用于捕获音频/视频的录制器对象。
添加一个
QMediaRecorder对象到捕获会话中,以启用从捕获会话中录制音频和/或视频。- Access functions:
- property screenCaptureᅟ: QScreenCapture¶
此属性用于保存用于捕获屏幕的对象。
通过使用此属性将屏幕捕获对象添加到捕获会话中来录制屏幕。
- Access functions:
- property videoFrameInputᅟ: QVideoFrameInput¶
此属性保存用于将自定义视频帧发送到
QMediaRecorder或视频输出的对象。- Access functions:
返回会话的视频输出。
- Access functions:
- property windowCaptureᅟ: QWindowCapture¶
此属性用于保存用于捕获窗口的对象。
通过使用此属性将窗口捕获对象添加到捕获会话中来记录窗口。
- Access functions:
为从
parent对象捕获媒体创建一个会话。- audioBufferInput()¶
- Return type:
属性
audioBufferInputᅟ的获取器。- audioBufferInputChanged()¶
属性
audioBufferInputᅟ的通知信号。- audioInput()¶
- Return type:
另请参阅
属性
audioInputᅟ的获取器。- audioInputChanged()¶
属性
audioInputᅟ的通知信号。- audioOutput()¶
- Return type:
另请参阅
属性
audioOutputᅟ的获取器。- audioOutputChanged()¶
属性
audioOutputᅟ的通知信号。- camera()¶
- Return type:
另请参阅
属性
cameraᅟ的获取器。- cameraChanged()¶
属性
cameraᅟ的通知信号。- imageCapture()¶
- Return type:
另请参阅
属性
imageCaptureᅟ的获取器。- imageCaptureChanged()¶
属性
imageCaptureᅟ的通知信号。- recorder()¶
- Return type:
另请参阅
属性
recorderᅟ的获取器。- recorderChanged()¶
属性
recorderᅟ的通知信号。- screenCapture()¶
- Return type:
另请参阅
属性
screenCaptureᅟ的获取器。- screenCaptureChanged()¶
属性
screenCaptureᅟ的通知信号。- setAudioBufferInput(input)¶
- Parameters:
输入 –
QAudioBufferInput
另请参阅
属性
audioBufferInputᅟ的设置器。- setAudioInput(input)¶
- Parameters:
输入 –
QAudioInput
将音频输入设备设置为
input。如果将其设置为空的QAudioDevice,捕获会话将使用操作系统定义的默认输入。另请参阅
属性
audioInputᅟ的设置器。- setAudioOutput(output)¶
- Parameters:
输出 –
QAudioOutput
将音频输出设备设置为
output。设置音频输出设备可以从音频输入设备启用音频路由。
另请参阅
属性
audioOutputᅟ的设置器。属性
cameraᅟ的设置器。- setImageCapture(imageCapture)¶
- Parameters:
imageCapture –
QImageCapture
另请参阅
属性
imageCaptureᅟ的设置器。- setRecorder(recorder)¶
- Parameters:
recorder –
QMediaRecorder
另请参阅
属性
recorderᅟ的设置器。- setScreenCapture(screenCapture)¶
- Parameters:
screenCapture –
QScreenCapture
另请参阅
属性
screenCaptureᅟ的设置器。- setVideoFrameInput(input)¶
- Parameters:
输入 –
QVideoFrameInput
另请参阅
属性
videoFrameInputᅟ的设置器。设置一个QObject(
output)为捕获会话的视频预览。基于QObject的预览预计将具有一个可调用的
videoSink()方法,该方法返回一个QVideoSink。之前设置的预览已分离。
另请参阅
属性
videoOutputᅟ的设置器。- setVideoSink(sink)¶
- Parameters:
sink –
QVideoSink
设置一个
QVideoSink,(sink),用于捕获会话的视频预览。基于QObject的预览预计将具有一个可调用的
videoSink()方法,该方法返回一个QVideoSink。之前设置的预览已分离。
另请参阅
- setWindowCapture(windowCapture)¶
- Parameters:
windowCapture –
QWindowCapture
另请参阅
属性
windowCaptureᅟ的设置器。- videoFrameInput()¶
- Return type:
另请参阅
属性
videoFrameInputᅟ的获取器。- videoFrameInputChanged()¶
属性
videoFrameInputᅟ的通知信号。- videoOutput()¶
- Return type:
另请参阅
属性
videoOutputᅟ的获取器。- videoOutputChanged()¶
属性
videoOutputᅟ的通知信号。- videoSink()¶
- Return type:
返回会话的
QVideoSink。另请参阅
- windowCapture()¶
- Return type:
另请参阅
属性
windowCaptureᅟ的获取器。- windowCaptureChanged()¶
属性
windowCaptureᅟ的通知信号。