PySide6.QtMultimedia.QMediaCaptureSession

class QMediaCaptureSession

QMediaCaptureSession 类允许捕获音频和视频内容。更多

PySide6.QtMultimedia.QMediaCaptureSession 的继承图

在版本6.1中添加。

概要

属性

方法

信号

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

QMediaCaptureSession 是管理本地设备上媒体捕获的核心类。

您可以使用setCamera()setScreenCapture()setWindowCapture()setVideoFrameInput()将视频输入连接到QMediaCaptureSession。通过使用setVideoOutput()设置QVideoWidgetQGraphicsVideoItem,可以查看捕获媒体的预览。

您可以使用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:
property cameraᅟ: QCamera

此属性保存用于捕获视频的相机。

通过使用此属性将相机添加到捕获会话中来录制视频或拍摄图像。

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:
property videoOutputᅟ: QObject

返回会话的视频输出。

Access functions:
property windowCaptureᅟ: QWindowCapture

此属性用于保存用于捕获窗口的对象。

通过使用此属性将窗口捕获对象添加到捕获会话中来记录窗口。

Access functions:
__init__([parent=None])
Parameters:

父对象QObject

为从parent对象捕获媒体创建一个会话。

audioBufferInput()
Return type:

QAudioBufferInput

另请参阅

setAudioBufferInput()

属性 audioBufferInputᅟ 的获取器。

audioBufferInputChanged()

属性 audioBufferInputᅟ 的通知信号。

audioInput()
Return type:

QAudioInput

另请参阅

setAudioInput()

属性 audioInputᅟ 的获取器。

audioInputChanged()

属性 audioInputᅟ 的通知信号。

audioOutput()
Return type:

QAudioOutput

另请参阅

setAudioOutput()

属性 audioOutputᅟ 的获取器。

audioOutputChanged()

属性 audioOutputᅟ 的通知信号。

camera()
Return type:

QCamera

另请参阅

setCamera()

属性 cameraᅟ 的获取器。

cameraChanged()

属性 cameraᅟ 的通知信号。

imageCapture()
Return type:

QImageCapture

另请参阅

setImageCapture()

属性 imageCaptureᅟ 的获取器。

imageCaptureChanged()

属性 imageCaptureᅟ 的通知信号。

recorder()
Return type:

QMediaRecorder

另请参阅

setRecorder()

属性 recorderᅟ 的获取器。

recorderChanged()

属性 recorderᅟ 的通知信号。

screenCapture()
Return type:

QScreenCapture

另请参阅

setScreenCapture()

属性 screenCaptureᅟ 的获取器。

screenCaptureChanged()

属性 screenCaptureᅟ 的通知信号。

setAudioBufferInput(input)
Parameters:

输入QAudioBufferInput

另请参阅

audioBufferInput()

属性 audioBufferInputᅟ 的设置器。

setAudioInput(input)
Parameters:

输入QAudioInput

将音频输入设备设置为input。如果将其设置为空的QAudioDevice,捕获会话将使用操作系统定义的默认输入。

另请参阅

audioInput()

属性 audioInputᅟ 的设置器。

setAudioOutput(output)
Parameters:

输出QAudioOutput

将音频输出设备设置为 output

设置音频输出设备可以从音频输入设备启用音频路由。

另请参阅

audioOutput()

属性 audioOutputᅟ 的设置器。

setCamera(camera)
Parameters:

相机QCamera

另请参阅

camera()

属性 cameraᅟ 的设置器。

setImageCapture(imageCapture)
Parameters:

imageCaptureQImageCapture

另请参阅

imageCapture()

属性 imageCaptureᅟ 的设置器。

setRecorder(recorder)
Parameters:

recorderQMediaRecorder

另请参阅

recorder()

属性 recorderᅟ 的设置器。

setScreenCapture(screenCapture)
Parameters:

screenCaptureQScreenCapture

另请参阅

screenCapture()

属性 screenCaptureᅟ 的设置器。

setVideoFrameInput(input)
Parameters:

输入QVideoFrameInput

另请参阅

videoFrameInput()

属性 videoFrameInputᅟ 的设置器。

setVideoOutput(output)
Parameters:

输出QObject

设置一个QObject(output)为捕获会话的视频预览。

基于QObject的预览预计将具有一个可调用的videoSink()方法,该方法返回一个QVideoSink

之前设置的预览已分离。

另请参阅

videoOutput()

属性 videoOutputᅟ 的设置器。

setVideoSink(sink)
Parameters:

sinkQVideoSink

设置一个QVideoSink,(sink),用于捕获会话的视频预览。

基于QObject的预览预计将具有一个可调用的videoSink()方法,该方法返回一个QVideoSink

之前设置的预览已分离。

另请参阅

videoSink()

setWindowCapture(windowCapture)
Parameters:

windowCaptureQWindowCapture

另请参阅

windowCapture()

属性 windowCaptureᅟ 的设置器。

videoFrameInput()
Return type:

QVideoFrameInput

另请参阅

setVideoFrameInput()

属性 videoFrameInputᅟ 的获取器。

videoFrameInputChanged()

属性 videoFrameInputᅟ 的通知信号。

videoOutput()
Return type:

QObject

另请参阅

setVideoOutput()

属性 videoOutputᅟ 的获取器。

videoOutputChanged()

属性 videoOutputᅟ 的通知信号。

videoSink()
Return type:

QVideoSink

返回会话的QVideoSink

另请参阅

setVideoSink()

windowCapture()
Return type:

QWindowCapture

另请参阅

setWindowCapture()

属性 windowCaptureᅟ 的获取器。

windowCaptureChanged()

属性 windowCaptureᅟ 的通知信号。