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

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]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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.