CameraRecorder QML Type

Controls video recording with the Camera. More...

Import Statement: import QtMultimedia 5.15

Properties

Methods

Detailed Description

CameraRecorder allows recording camera streams to files, and adjusting recording settings and metadata for videos.

It should not be constructed separately, instead the videoRecorder property of a Camera should be used.

 Camera {
     videoRecorder.audioEncodingMode: CameraRecorder.ConstantBitrateEncoding;
     videoRecorder.audioBitRate: 128000
     videoRecorder.mediaContainer: "mp4"
     // ...
 }

There are many different settings for each part of the recording process (audio, video, and output formats), as well as control over muting and where to store the output file.

See also QAudioEncoderSettings and QVideoEncoderSettings.

Property Documentation

actualLocation : string

This property holds the actual location of the last saved media content. The actual location is usually available after the recording starts, and reset when new location is set or the new recording starts.


audioBitRate : int

This property holds the audio bit rate (in bits per second) to be used for recording video.


audioChannels : int

This property indicates the number of audio channels to be encoded while recording video (1 is mono, 2 is stereo).


audioCodec : string

This property holds the audio codec to be used for recording video. Typically this is aac or amr-wb.

See also whileBalanceMode.


audioEncodingMode : enumeration

The type of encoding method to use when recording audio.

ValueDescription
ConstantQualityEncodingEncoding will aim to have a constant quality, adjusting bitrate to fit. This is the default. The bitrate setting will be ignored.
ConstantBitRateEncodingEncoding will use a constant bit rate, adjust quality to fit. This is appropriate if you are trying to optimize for space.
AverageBitRateEncodingEncoding will try to keep an average bitrate setting, but will use more or less as needed.

audioSampleRate : int

This property holds the sample rate to be used to encode audio while recording video.


duration : int

This property holds the duration (in miliseconds) of the last recording.


errorCode : enumeration

This property holds the last error code.

ValueDescription
NoErrorNo Errors
ResourceErrorDevice is not ready or not available.
FormatErrorCurrent format is not supported.
OutOfSpaceErrorNo space left on device.

errorString : string

This property holds the description of the last error.


frameRate : qreal

This property holds the framerate (in frames per second) to be used for recording video.


mediaContainer : string

This property holds the media container to be used for recording video. Typically this is mp4.


muted : bool

This property indicates whether the audio input is muted during recording.


outputLocation : string

This property holds the destination location of the media content. If the location is empty, the recorder uses the system-specific place and file naming scheme.


recorderState : enumeration

This property holds the current state of the camera recorder object.

The state can be one of these two:

ValueDescription
StoppedStateThe camera is not recording video.
RecordingStateThe camera is recording video.

recorderStatus : enumeration

This property holds the current status of media recording.

ValueDescription
UnavailableStatusRecording is not supported by the camera.
UnloadedStatusThe recorder is available but not loaded.
LoadingStatusThe recorder is initializing.
LoadedStatusThe recorder is initialized and ready to record media.
StartingStatusRecording is requested but not active yet.
RecordingStatusRecording is active.
PausedStatusRecording is paused.
FinalizingStatusRecording is stopped with media being finalized.

resolution : size

This property holds the video frame dimensions to be used for video capture.


videoBitRate : int

This property holds the bit rate (in bits per second) to be used for recording video.


videoCodec : string

This property holds the video codec to be used for recording video. Typically this is h264.


videoEncodingMode : enumeration

This property holds the type of encoding method to be used for recording video.

The following are the different encoding methods used:

ValueDescription
ConstantQualityEncodingEncoding will aim to have a constant quality, adjusting bitrate to fit. This is the default. The bitrate setting will be ignored.
ConstantBitRateEncodingEncoding will use a constant bit rate, adjust quality to fit. This is appropriate if you are trying to optimize for space.
AverageBitRateEncodingEncoding will try to keep an average bitrate setting, but will use more or less as needed.

Method Documentation

record()

Starts recording.


setMetadata(key, value)

Sets metadata for the next video to be recorder, with the given key being associated with value.


stop()

Stops recording.