QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
QgsVideoExporter Class Reference

Handles exports of sequential image files to video formats. More...

#include <qgsvideoexporter.h>

Inheritance diagram for QgsVideoExporter:

Public Slots

void writeVideo ()
 Starts the video export operation.

Signals

void finished ()
 Emitted when the video export finishes.

Public Member Functions

 QgsVideoExporter (const QString &filename, QSize size, double framesPerSecond)
 Constructor for QgsVideoExporter.
 ~QgsVideoExporter () override
QMediaRecorder::Error error () const
 Returns the last error received while writing the video.
QString errorString () const
 Returns the string describing the last error received while writing the video.
QgsFeedbackfeedback ()
 Returns the optional feedback object.
QMediaFormat::FileFormat fileFormat () const
 Returns the output file format.
qint64 frameDuration () const
 Returns the duration of each frame, in micro-seconds.
double framesPerSecond () const
 Returns the output video frames per second.
QStringList inputFiles () const
 Returns the list of input image files.
void setFeedback (QgsFeedback *feedback)
 Sets an optional feedback object, for progress reports and cancellation support.
void setFileFormat (QMediaFormat::FileFormat format)
 Sets the output file format.
void setInputFiles (const QStringList &files)
 Sets the list of input image files.
void setInputFilesByPattern (const QString &directory, const QString &pattern)
 Sets the input image files by searching a directory for files matching a pattern.
void setVideoCodec (QMediaFormat::VideoCodec codec)
 Sets the output video codec.
QSize size () const
 Returns the output video frame size.
QMediaFormat::VideoCodec videoCodec () const
 Returns the output video codec.

Static Public Member Functions

static bool isAvailable ()
 Returns true if the video export functionality is available on the current system.

Detailed Description

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.

Since
QGIS 4.0

Definition at line 44 of file qgsvideoexporter.h.

Constructor & Destructor Documentation

◆ QgsVideoExporter()

QgsVideoExporter::QgsVideoExporter ( const QString & filename,
QSize size,
double framesPerSecond )

Constructor for QgsVideoExporter.

Parameters
filenamedestination video file name
sizeoutput video frame size
framesPerSecondoutput video frames per second

Definition at line 42 of file qgsvideoexporter.cpp.

◆ ~QgsVideoExporter()

QgsVideoExporter::~QgsVideoExporter ( )
override

Definition at line 51 of file qgsvideoexporter.cpp.

Member Function Documentation

◆ error()

QMediaRecorder::Error QgsVideoExporter::error ( ) const

Returns the last error received while writing the video.

See also
errorString()

Definition at line 109 of file qgsvideoexporter.cpp.

◆ errorString()

QString QgsVideoExporter::errorString ( ) const

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

See also
error()

Definition at line 115 of file qgsvideoexporter.cpp.

◆ feedback()

QgsFeedback * QgsVideoExporter::feedback ( )

Returns the optional feedback object.

See also
setFeedback()

Definition at line 60 of file qgsvideoexporter.cpp.

◆ fileFormat()

QMediaFormat::FileFormat QgsVideoExporter::fileFormat ( ) const

Returns the output file format.

See also
setFileFormat()

Definition at line 94 of file qgsvideoexporter.cpp.

◆ finished

void QgsVideoExporter::finished ( )
signal

Emitted when the video export finishes.

◆ frameDuration()

qint64 QgsVideoExporter::frameDuration ( ) const
inline

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

See also
framesPerSecond()

Definition at line 93 of file qgsvideoexporter.h.

◆ framesPerSecond()

double QgsVideoExporter::framesPerSecond ( ) const
inline

Returns the output video frames per second.

See also
frameDuration()

Definition at line 86 of file qgsvideoexporter.h.

◆ inputFiles()

QStringList QgsVideoExporter::inputFiles ( ) const

Returns the list of input image files.

See also
setInputFiles()

Definition at line 83 of file qgsvideoexporter.cpp.

◆ isAvailable()

bool QgsVideoExporter::isAvailable ( )
static

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

Definition at line 33 of file qgsvideoexporter.cpp.

◆ setFeedback()

void QgsVideoExporter::setFeedback ( QgsFeedback * feedback)

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

Definition at line 55 of file qgsvideoexporter.cpp.

◆ setFileFormat()

void QgsVideoExporter::setFileFormat ( QMediaFormat::FileFormat format)

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

Definition at line 89 of file qgsvideoexporter.cpp.

◆ setInputFiles()

void QgsVideoExporter::setInputFiles ( const QStringList & files)

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
setInputFilesByPattern()
inputFiles()

Definition at line 65 of file qgsvideoexporter.cpp.

◆ setInputFilesByPattern()

void QgsVideoExporter::setInputFilesByPattern ( const QString & directory,
const QString & pattern )

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()
inputFiles()

Definition at line 70 of file qgsvideoexporter.cpp.

◆ setVideoCodec()

void QgsVideoExporter::setVideoCodec ( QMediaFormat::VideoCodec codec)

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

Definition at line 99 of file qgsvideoexporter.cpp.

◆ size()

QSize QgsVideoExporter::size ( ) const
inline

Returns the output video frame size.

Definition at line 98 of file qgsvideoexporter.h.

◆ videoCodec()

QMediaFormat::VideoCodec QgsVideoExporter::videoCodec ( ) const

Returns the output video codec.

See also
setVideoCodec()

Definition at line 104 of file qgsvideoexporter.cpp.

◆ writeVideo

void QgsVideoExporter::writeVideo ( )
slot

Starts the video export operation.

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

Exceptions
QgsNotSupportedExceptionif writing video is not supported on the current system.

Definition at line 120 of file qgsvideoexporter.cpp.


The documentation for this class was generated from the following files: