CameraRecorder QML Type | Qt Multimedia 5.15.18

- Qt 5.15
- Qt Multimedia
- QML Types
- CameraRecorder QML Type
- Qt 5.15.18 Reference Documentation

# CameraRecorder QML Type

Controls video recording with the Camera. More...

Import Statement: | import QtMultimedia 5.15

- List of all members, including inherited members

## Properties

- actualLocation : string
- audioBitRate : int
- audioChannels : int
- audioCodec : string
- audioEncodingMode : enumeration
- audioSampleRate : int
- duration : int
- errorCode : enumeration
- errorString : string
- frameRate : qreal
- mediaContainer : string
- muted : bool
- outputLocation : string
- recorderState : enumeration
- recorderStatus : enumeration
- resolution : size
- videoBitRate : int
- videoCodec : string
- videoEncodingMode : enumeration

## Methods

- record()
- setMetadata(key, value)
- stop()

## 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.

Value | Description
--- | ---
ConstantQualityEncoding | Encoding will aim to have a constant quality, adjusting bitrate to fit. This is the default. The bitrate setting will be ignored.
ConstantBitRateEncoding | Encoding will use a constant bit rate, adjust quality to fit. This is appropriate if you are trying to optimize for space.
AverageBitRateEncoding | Encoding 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.

Value | Description
--- | ---
NoError | No Errors
ResourceError | Device is not ready or not available.
FormatError | Current format is not supported.
OutOfSpaceError | No 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:

Value | Description
--- | ---
StoppedState | The camera is not recording video.
RecordingState | The camera is recording video.

recorderStatus : enumeration

This property holds the current status of media recording.

Value | Description
--- | ---
UnavailableStatus | Recording is not supported by the camera.
UnloadedStatus | The recorder is available but not loaded.
LoadingStatus | The recorder is initializing.
LoadedStatus | The recorder is initialized and ready to record media.
StartingStatus | Recording is requested but not active yet.
RecordingStatus | Recording is active.
PausedStatus | Recording is paused.
FinalizingStatus | Recording 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:

Value | Description
--- | ---
ConstantQualityEncoding | Encoding will aim to have a constant quality, adjusting bitrate to fit. This is the default. The bitrate setting will be ignored.
ConstantBitRateEncoding | Encoding will use a constant bit rate, adjust quality to fit. This is appropriate if you are trying to optimize for space.
AverageBitRateEncoding | Encoding 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.