class QMediaCaptureSession#

The QMediaCaptureSession class allows capturing of audio and video content. More

Inheritance diagram of PySide6.QtMultimedia.QMediaCaptureSession

New in version 6.1.

Synopsis#

Properties#

Methods#

Signals#

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#

The QMediaCaptureSession is the central class that manages capturing of media on the local device.

You can connect a video input to QMediaCaptureSession using setCamera() , setScreenCapture() or setWindowCapture() . A preview of the captured media can be seen by setting a QVideoWidget or QGraphicsVideoItem using setVideoOutput() .

You can connect a microphone to QMediaCaptureSession using setAudioInput() . The captured sound can be heard by routing the audio to an output device using setAudioOutput() .

You can capture still images from a camera by setting a QImageCapture object on the capture session, and record audio/video using a QMediaRecorder .

Note

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

property audioInputᅟ: QAudioInput#

Returns the device that is being used to capture audio.

Access functions:
property audioOutputᅟ: QAudioOutput#

Returns the audio output for the session.

Access functions:
property cameraᅟ: QCamera#

This property holds The camera used to capture video..

Record video or take images by adding a camera to the capture session using this property.

Access functions:
property imageCaptureᅟ: QImageCapture#

This property holds the object used to capture still images..

Add a QImageCapture object to the capture session to enable capturing of still images from the camera.

Access functions:
property recorderᅟ: QMediaRecorder#

This property holds The recorder object used to capture audio/video..

Add a QMediaRecorder object to the capture session to enable recording of audio and/or video from the capture session.

Access functions:
property screenCaptureᅟ: QScreenCapture#

This property holds The object used to capture a screen..

Record a screen by adding a screen capture object to the capture session using this property.

Access functions:
property videoOutputᅟ: QObject#

Returns the video output for the session.

Access functions:
property windowCaptureᅟ: QWindowCapture#

This property holds The object used to capture a window..

Record a window by adding a window capture objet to the capture session using this property.

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

parentQObject

Creates a session for media capture from the parent object.

audioInput()#
Return type:

QAudioInput

See also

setAudioInput()

Getter of property audioInputᅟ .

audioInputChanged()#

Notification signal of property audioInputᅟ .

audioOutput()#
Return type:

QAudioOutput

See also

setAudioOutput()

Getter of property audioOutputᅟ .

audioOutputChanged()#

Notification signal of property audioOutputᅟ .

camera()#
Return type:

QCamera

See also

setCamera()

Getter of property cameraᅟ .

cameraChanged()#

Notification signal of property cameraᅟ .

imageCapture()#
Return type:

QImageCapture

Getter of property imageCaptureᅟ .

imageCaptureChanged()#

Notification signal of property imageCaptureᅟ .

recorder()#
Return type:

QMediaRecorder

See also

setRecorder()

Getter of property recorderᅟ .

recorderChanged()#

Notification signal of property recorderᅟ .

screenCapture()#
Return type:

QScreenCapture

Getter of property screenCaptureᅟ .

screenCaptureChanged()#

Notification signal of property screenCaptureᅟ .

setAudioInput(input)#
Parameters:

inputQAudioInput

Sets the audio input device to input. If setting it to an empty QAudioDevice the capture session will use the default input as defined by the operating system.

See also

audioInput()

Setter of property audioInputᅟ .

setAudioOutput(output)#
Parameters:

outputQAudioOutput

Sets the audio output device to output.

Setting an audio output device enables audio routing from an audio input device.

See also

audioOutput()

Setter of property audioOutputᅟ .

setCamera(camera)#
Parameters:

cameraQCamera

See also

camera()

Setter of property cameraᅟ .

setImageCapture(imageCapture)#
Parameters:

imageCaptureQImageCapture

See also

imageCapture()

Setter of property imageCaptureᅟ .

setRecorder(recorder)#
Parameters:

recorderQMediaRecorder

See also

recorder()

Setter of property recorderᅟ .

setScreenCapture(screenCapture)#
Parameters:

screenCaptureQScreenCapture

See also

screenCapture()

Setter of property screenCaptureᅟ .

setVideoOutput(output)#
Parameters:

outputQObject

Sets a QObject, (output), to a video preview for the capture session.

A QObject based preview is expected to have an invokable videoSink() method that returns a QVideoSink .

The previously set preview is detached.

See also

videoOutput()

Setter of property videoOutputᅟ .

setVideoSink(sink)#
Parameters:

sinkQVideoSink

Sets a QVideoSink , (sink), to a video preview for the capture session.

A QObject based preview is expected to have an invokable videoSink() method that returns a QVideoSink .

The previously set preview is detached.

See also

videoSink()

setWindowCapture(windowCapture)#
Parameters:

windowCaptureQWindowCapture

See also

windowCapture()

Setter of property windowCaptureᅟ .

videoOutput()#
Return type:

QObject

See also

setVideoOutput()

Getter of property videoOutputᅟ .

videoOutputChanged()#

Notification signal of property videoOutputᅟ .

videoSink()#
Return type:

QVideoSink

Returns the QVideoSink for the session.

See also

setVideoSink()

windowCapture()#
Return type:

QWindowCapture

Getter of property windowCaptureᅟ .

windowCaptureChanged()#

Notification signal of property windowCaptureᅟ .