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.

Class Hierarchy

Inheritance diagram of qgis.core.QgsVideoExporter

Base classes

QObject

Methods

errorString

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

feedback

Returns the optional feedback object.

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.

setInputFiles

Sets the list of input image files.

setInputFilesByPattern

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

size

Returns the output video frame size.

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

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]

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])

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:
  • directory (Optional[str])

  • pattern (Optional[str])

size(self) QSize[source]

Returns the output video frame size.

Return type:

QSize

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.