QMediaRecorder¶
The
QMediaRecorder
class is used for the recording of media content. More…
Inherited by: QAudioRecorder
Synopsis¶
Functions¶
def
actualLocation
()def
audioCodecDescription
(codecName)def
audioSettings
()def
availability
()def
availableMetaData
()def
containerDescription
(format)def
containerFormat
()def
duration
()def
error
()def
errorString
()def
isAvailable
()def
isMetaDataAvailable
()def
isMetaDataWritable
()def
isMuted
()def
metaData
(key)def
outputLocation
()def
setAudioSettings
(audioSettings)def
setContainerFormat
(container)def
setEncodingSettings
(audioSettings[, videoSettings=QVideoEncoderSettings()[, containerMimeType=””]])def
setMetaData
(key, value)def
setOutputLocation
(location)def
setVideoSettings
(videoSettings)def
state
()def
status
()def
supportedAudioCodecs
()def
supportedContainers
()def
supportedVideoCodecs
()def
videoCodecDescription
(codecName)def
videoSettings
()def
volume
()
Slots¶
Signals¶
def
actualLocationChanged
(location)def
availabilityChanged
(availability)def
availabilityChanged
(available)def
durationChanged
(duration)def
error
(error)def
metaDataAvailableChanged
(available)def
metaDataChanged
()def
metaDataChanged
(key, value)def
metaDataWritableChanged
(writable)def
mutedChanged
(muted)def
stateChanged
(state)def
statusChanged
(status)def
volumeChanged
(volume)
Detailed Description¶
The
QMediaRecorder
class is a high level media recording class. It’s not intended to be used alone but for accessing the media recording functions of other media objects, likeQRadioTuner
, orQCamera
.recorder = new QMediaRecorder(camera); QAudioEncoderSettings audioSettings; audioSettings.setCodec("audio/amr"); audioSettings.setQuality(QMultimedia::HighQuality); recorder->setAudioSettings(audioSettings); recorder->setOutputLocation(QUrl::fromLocalFile(fileName)); recorder->record();See also
- class PySide2.QtMultimedia.QMediaRecorder(mediaObject[, parent=None])¶
- param parent:
- param mediaObject:
Constructs a media recorder which records the media produced by
mediaObject
.The
parent
is passed toQMediaObject
.
- PySide2.QtMultimedia.QMediaRecorder.State¶
Constant
Description
QMediaRecorder.StoppedState
The recorder is not active. If this is the state after recording then the actual created recording has finished being written to the final location and is ready on all platforms except on Android. On Android, due to platform limitations, there is no way to be certain that the recording has finished writing to the final location.
QMediaRecorder.RecordingState
The recording is requested.
QMediaRecorder.PausedState
The recorder is paused.
- PySide2.QtMultimedia.QMediaRecorder.Status¶
Constant
Description
QMediaRecorder.UnavailableStatus
The recorder is not available or not supported by connected media object.
QMediaRecorder.UnloadedStatus
The recorder is avilable but not loaded.
QMediaRecorder.LoadingStatus
The recorder is initializing.
QMediaRecorder.LoadedStatus
The recorder is initialized and ready to record media.
QMediaRecorder.StartingStatus
Recording is requested but not active yet.
QMediaRecorder.RecordingStatus
Recording is active.
QMediaRecorder.PausedStatus
Recording is paused.
QMediaRecorder.FinalizingStatus
Recording is stopped with media being finalized.
- PySide2.QtMultimedia.QMediaRecorder.Error¶
Constant
Description
QMediaRecorder.NoError
No Errors.
QMediaRecorder.ResourceError
Device is not ready or not available.
QMediaRecorder.FormatError
Current format is not supported.
QMediaRecorder.OutOfSpaceError
No space left on device.
- PySide2.QtMultimedia.QMediaRecorder.actualLocation()¶
- Return type:
This property holds the actual location of the last media content..
The actual location is usually available after recording starts, and reset when new location is set or new recording starts.
- PySide2.QtMultimedia.QMediaRecorder.actualLocationChanged(location)¶
- Parameters:
location –
PySide2.QtCore.QUrl
- PySide2.QtMultimedia.QMediaRecorder.audioCodecDescription(codecName)¶
- Parameters:
codecName – str
- Return type:
str
Returns a description of an audio
codec
.
- PySide2.QtMultimedia.QMediaRecorder.audioSettings()¶
- Return type:
Returns the audio encoder settings being used.
See also
- PySide2.QtMultimedia.QMediaRecorder.availability()¶
- Return type:
Returns the availability of this functionality.
See also
- PySide2.QtMultimedia.QMediaRecorder.availabilityChanged(availability)¶
- Parameters:
availability –
AvailabilityStatus
- PySide2.QtMultimedia.QMediaRecorder.availabilityChanged(available)
- Parameters:
available – bool
- PySide2.QtMultimedia.QMediaRecorder.availableMetaData()¶
- Return type:
list of strings
Returns a list of keys there is meta-data available for.
- PySide2.QtMultimedia.QMediaRecorder.containerDescription(format)¶
- Parameters:
format – str
- Return type:
str
Returns a description of a container
format
.
- PySide2.QtMultimedia.QMediaRecorder.containerFormat()¶
- Return type:
str
Returns the selected container format.
See also
- PySide2.QtMultimedia.QMediaRecorder.duration()¶
- Return type:
int
This property holds the recorded media duration in milliseconds..
- PySide2.QtMultimedia.QMediaRecorder.durationChanged(duration)¶
- Parameters:
duration – int
- PySide2.QtMultimedia.QMediaRecorder.error()¶
- Return type:
Returns the current error state.
See also
- PySide2.QtMultimedia.QMediaRecorder.error(error)
- Parameters:
error –
Error
- PySide2.QtMultimedia.QMediaRecorder.errorString()¶
- Return type:
str
Returns a string describing the current error state.
See also
- PySide2.QtMultimedia.QMediaRecorder.isAvailable()¶
- Return type:
bool
Returns true if media recorder service ready to use.
See also
- PySide2.QtMultimedia.QMediaRecorder.isMetaDataAvailable()¶
- Return type:
bool
This property holds whether access to a media object’s meta-data is available..
If this is true there is meta-data available, otherwise there is no meta-data available.
- PySide2.QtMultimedia.QMediaRecorder.isMetaDataWritable()¶
- Return type:
bool
This property holds whether a media object’s meta-data is writable..
If this is true the meta-data is writable, otherwise the meta-data is read-only.
- PySide2.QtMultimedia.QMediaRecorder.isMuted()¶
- Return type:
bool
This property holds whether a recording audio stream is muted..
- PySide2.QtMultimedia.QMediaRecorder.metaData(key)¶
- Parameters:
key – str
- Return type:
object
Returns the value associated with a meta-data
key
.See also
- PySide2.QtMultimedia.QMediaRecorder.metaDataAvailableChanged(available)¶
- Parameters:
available – bool
- PySide2.QtMultimedia.QMediaRecorder.metaDataChanged()¶
- PySide2.QtMultimedia.QMediaRecorder.metaDataChanged(key, value)
- Parameters:
key – str
value – object
- PySide2.QtMultimedia.QMediaRecorder.metaDataWritableChanged(writable)¶
- Parameters:
writable – bool
- PySide2.QtMultimedia.QMediaRecorder.mutedChanged(muted)¶
- Parameters:
muted – bool
- PySide2.QtMultimedia.QMediaRecorder.outputLocation()¶
- Return type:
This property holds the destination location of media content..
Setting the location can fail, for example when the service supports only local file system locations but a network URL was passed. If the service does not support media recording this setting the output location will always fail.
The
location
can be relative or empty; in this case the recorder uses the system specific place and file naming scheme. After recording has stated, returns the actual output location.
- PySide2.QtMultimedia.QMediaRecorder.pause()¶
Pause recording.
The recorder state is changed to
PausedState
.Depending on platform recording pause may be not supported, in this case the recorder state stays unchanged.
- PySide2.QtMultimedia.QMediaRecorder.record()¶
Start recording.
While the recorder state is changed immediately to
RecordingState
, recording may start asynchronously, withstatusChanged
(RecordingStatus
) signal emitted when recording starts.If recording fails
error()
signal is emitted with recorder state being reset back toStoppedState
.
- PySide2.QtMultimedia.QMediaRecorder.setAudioSettings(audioSettings)¶
- Parameters:
audioSettings –
PySide2.QtMultimedia.QAudioEncoderSettings
Sets the audio encoder
settings
.If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.
It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
- PySide2.QtMultimedia.QMediaRecorder.setContainerFormat(container)¶
- Parameters:
container – str
Sets the media
container
format.If the container format is not specified, the encoder will choose format, depending on media source properties and encoding settings selected.
It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
- PySide2.QtMultimedia.QMediaRecorder.setEncodingSettings(audioSettings[, videoSettings=QVideoEncoderSettings()[, containerMimeType=""]])¶
- Parameters:
audioSettings –
PySide2.QtMultimedia.QAudioEncoderSettings
videoSettings –
PySide2.QtMultimedia.QVideoEncoderSettings
containerMimeType – str
Sets the
audio
andvideo
encoder settings andcontainer
format.If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.
It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
- PySide2.QtMultimedia.QMediaRecorder.setMetaData(key, value)¶
- Parameters:
key – str
value – object
Sets a
value
for a meta-datakey
.Note
To ensure that meta data is set corretly, it should be set before starting the recording. Once the recording is stopped, any meta data set will be attached to the next recording.
See also
- PySide2.QtMultimedia.QMediaRecorder.setMuted(muted)¶
- Parameters:
muted – bool
This property holds whether a recording audio stream is muted..
- PySide2.QtMultimedia.QMediaRecorder.setOutputLocation(location)¶
- Parameters:
location –
PySide2.QtCore.QUrl
- Return type:
bool
See also
- PySide2.QtMultimedia.QMediaRecorder.setVideoSettings(videoSettings)¶
- Parameters:
videoSettings –
PySide2.QtMultimedia.QVideoEncoderSettings
Sets the video encoder
settings
.If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.
It’s only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
- PySide2.QtMultimedia.QMediaRecorder.setVolume(volume)¶
- Parameters:
volume – float
This property holds the current recording audio volume..
The volume is scaled linearly from
0.0
(silence) to1.0
(full volume). Values outside this range will be clamped.The default volume is
1.0
.UI volume controls should usually be scaled nonlinearly. For example, using a logarithmic scale will produce linear changes in perceived loudness, which is what a user would normally expect from a volume control. See
convertVolume()
for more details.
- PySide2.QtMultimedia.QMediaRecorder.state()¶
- Return type:
This property holds The current state of the media recorder..
The state property represents the user request and is changed synchronously during
record()
,pause()
orstop()
calls. Recorder state may also change asynchronously when recording fails.
- PySide2.QtMultimedia.QMediaRecorder.status()¶
- Return type:
This property holds The current status of the media recorder..
The status is changed asynchronously and represents the actual status of media recorder.
- PySide2.QtMultimedia.QMediaRecorder.stop()¶
Stop recording.
The recorder state is changed to
StoppedState
.
- PySide2.QtMultimedia.QMediaRecorder.supportedAudioCodecs()¶
- Return type:
list of strings
Returns a list of supported audio codecs.
- PySide2.QtMultimedia.QMediaRecorder.supportedContainers()¶
- Return type:
list of strings
Returns a list of supported container formats.
- PySide2.QtMultimedia.QMediaRecorder.supportedVideoCodecs()¶
- Return type:
list of strings
Returns a list of supported video codecs.
- PySide2.QtMultimedia.QMediaRecorder.videoCodecDescription(codecName)¶
- Parameters:
codecName – str
- Return type:
str
Returns a description of a video
codec
.See also
- PySide2.QtMultimedia.QMediaRecorder.videoSettings()¶
- Return type:
Returns the video encoder settings being used.
See also
- PySide2.QtMultimedia.QMediaRecorder.volume()¶
- Return type:
float
This property holds the current recording audio volume..
The volume is scaled linearly from
0.0
(silence) to1.0
(full volume). Values outside this range will be clamped.The default volume is
1.0
.UI volume controls should usually be scaled nonlinearly. For example, using a logarithmic scale will produce linear changes in perceived loudness, which is what a user would normally expect from a volume control. See
convertVolume()
for more details.
- PySide2.QtMultimedia.QMediaRecorder.volumeChanged(volume)¶
- Parameters:
volume – float
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.