Class: QgsVideoExporter

Handles exports of sequential image files to video formats.

Video export functionality is not available on all systems. The isAvailable() function can be used to test whether video export is available on the current system.

Added in version 4.0.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsVideoExporter

Base classes

QObject

Methods

error

Returns the last error received while writing the video.

errorString

Returns the string describing the last error received while writing the video.

feedback

Returns the optional feedback object.

fileFormat

Returns the output file format.

frameDuration

Returns the duration of each frame, in micro-seconds.

framesPerSecond

Returns the output video frames per second.

inputFiles

Returns the list of input image files.

setFeedback

Sets an optional feedback object, for progress reports and cancellation support.

setFileFormat

Sets the output file format.

setInputFiles

Sets the list of input image files.

setInputFilesByPattern

Sets the input image files by searching a directory for files matching a pattern.

setVideoCodec

Sets the output video codec.

size

Returns the output video frame size.

videoCodec

Returns the output video codec.

writeVideo

Starts the video export operation.

Static Methods

isAvailable

Returns True if the video export functionality is available on the current system.

Signals

finished

Emitted when the video export finishes.

class qgis.core.QgsVideoExporter[source]

Bases: QObject

__init__(filename: str | None, size: QSize, framesPerSecond: float)

Constructor for QgsVideoExporter.

Parameters:
  • filename (Optional[str]) – destination video file name

  • size (QSize) – output video frame size

  • framesPerSecond (float) – output video frames per second

error(self) QMediaRecorder.Error[source]

Returns the last error received while writing the video.

See also

errorString()

Return type:

QMediaRecorder.Error

errorString(self) str[source]

Returns the string describing the last error received while writing the video.

See also

error()

Return type:

str

feedback(self) QgsFeedback | None[source]

Returns the optional feedback object.

See also

setFeedback()

Return type:

Optional[QgsFeedback]

fileFormat(self) QMediaFormat.FileFormat[source]

Returns the output file format.

See also

setFileFormat()

Return type:

QMediaFormat.FileFormat

signal finished[source]

Emitted when the video export finishes.

frameDuration(self) int[source]

Returns the duration of each frame, in micro-seconds.

Return type:

int

framesPerSecond(self) float[source]

Returns the output video frames per second.

See also

frameDuration()

Return type:

float

inputFiles(self) list[str][source]

Returns the list of input image files.

See also

setInputFiles()

Return type:

list[str]

static isAvailable() bool[source]

Returns True if the video export functionality is available on the current system.

Return type:

bool

setFeedback(self, feedback: QgsFeedback | None)[source]

Sets an optional feedback object, for progress reports and cancellation support.

The object must exist for the lifetime of the export, ownership is not transferred.

See also

feedback()

Parameters:

feedback (Optional[QgsFeedback])

setFileFormat(self, format: QMediaFormat.FileFormat)[source]

Sets the output file format.

The Qt QMediaFormat.supportedFileFormats() method can be used to retrieve a list of formats supported by the system.

See also

fileFormat()

Parameters:

format (QMediaFormat.FileFormat)

setInputFiles(self, files: Iterable[str | None])[source]

Sets the list of input image files.

The list must be an ordered list of existing image file paths, which will form the output video frames.

See also

inputFiles()

Parameters:

files (Iterable[Optional[str]])

setInputFilesByPattern(self, directory: str | None, pattern: str | None)[source]

Sets the input image files by searching a directory for files matching a pattern.

E.g. setting pattern to “*.png” will find all PNG files in the directory and use them as input frames.

The frames will be sorted alphabetically by filename.

See also

setInputFiles()

See also

inputFiles()

Parameters:
setVideoCodec(self, codec: QMediaFormat.VideoCodec)[source]

Sets the output video codec.

The Qt QMediaFormat.supportedVideoCodecs() method can be used to retrieve a list of video codecs supported by the system.

See also

videoCodec()

Parameters:

codec (QMediaFormat.VideoCodec)

size(self) QSize[source]

Returns the output video frame size.

Return type:

QSize

videoCodec(self) QMediaFormat.VideoCodec[source]

Returns the output video codec.

See also

setVideoCodec()

Return type:

QMediaFormat.VideoCodec

writeVideo(self)[source]

Starts the video export operation.

The finished() signal will be emitted when the operation is complete.

Raises:

QgsNotSupportedException – if writing video is not supported on the current system.