![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Video encoder based on FFmpeg. More...
#include <QVideoEncoder.h>

Classes | |
| struct | OutputFormat |
| Output format. More... | |
Public Member Functions | |
| QVideoEncoder (QString filename, int width, int height, unsigned bitrate, int gop=12, int fps=25) | |
| Default constructor. More... | |
| virtual | ~QVideoEncoder () |
| bool | open (QString formatShortName, QStringList &errors) |
| Creates an (empty) video/anmiation file. More... | |
| bool | isOpen () const |
| Returns whether the file is opened or not. More... | |
| virtual bool | encodeImage (const QImage &image, int frameIndex, QString *errorString=nullptr) |
| Adds an image to the stream. More... | |
| virtual bool | close () |
| Closes the file. More... | |
Static Public Member Functions | |
| static bool | GetSupportedOutputFormats (std::vector< OutputFormat > &formats, bool ignoreIfNoFileExtension=true) |
| Returns the list of supported output formats. More... | |
Protected Member Functions | |
| bool | isSizeValid () |
| Returns whether the image size is valid. More... | |
| bool | initFrame () |
| void | freeFrame () |
| bool | convertImage_sws (const QImage &image, QString *errorString=nullptr) |
| Convert the QImage to the internal YUV format. More... | |
Protected Attributes | |
| QString | m_filename |
| int | m_width |
| int | m_height |
| unsigned | m_bitrate |
| int | m_gop |
| int | m_fps |
| bool | m_isOpen |
| FFmpegStuffEnc * | m_ff |
| FFmpeg variables. More... | |
Video encoder based on FFmpeg.
Definition at line 14 of file QVideoEncoder.h.
| QVideoEncoder::QVideoEncoder | ( | QString | filename, |
| int | width, | ||
| int | height, | ||
| unsigned | bitrate, | ||
| int | gop = 12, |
||
| int | fps = 25 |
||
| ) |
Default constructor.
| filename | video filename |
| width | video width (must be a multiple of 8) |
| height | video height (must be a multiple of 8) |
| bitrate | bit rate (e.g. 400 000) |
| gop | keyframe interval |
| fps | frame rate |
Definition at line 47 of file QVideoEncoder.cpp.
|
virtual |
Definition at line 62 of file QVideoEncoder.cpp.
|
virtual |
Closes the file.
Definition at line 330 of file QVideoEncoder.cpp.
References FFmpegStuffEnc::codecContext, FFmpegStuffEnc::formatContext, freeFrame(), m_ff, m_isOpen, and write_frame().
Referenced by ~QVideoEncoder().
|
protected |
Convert the QImage to the internal YUV format.
Definition at line 492 of file QVideoEncoder.cpp.
References format, FFmpegStuffEnc::frame, image, m_ff, m_height, m_width, and FFmpegStuffEnc::swsContext.
Referenced by encodeImage().
|
virtual |
Adds an image to the stream.
Definition at line 394 of file QVideoEncoder.cpp.
References FFmpegStuffEnc::codecContext, convertImage_sws(), FFmpegStuffEnc::frame, image, isOpen(), m_ff, and write_frame().
|
protected |
Definition at line 98 of file QVideoEncoder.cpp.
References FFmpegStuffEnc::frame, and m_ff.
Referenced by close().
|
static |
Returns the list of supported output formats.
Definition at line 106 of file QVideoEncoder.cpp.
References cloudViewer_ff_const59, QVideoEncoder::OutputFormat::extensions, format, QVideoEncoder::OutputFormat::longName, and QVideoEncoder::OutputFormat::shortName.
Referenced by qAnimationDlg::qAnimationDlg().
|
protected |
Definition at line 75 of file QVideoEncoder.cpp.
References FFmpegStuffEnc::codecContext, FFmpegStuffEnc::frame, and m_ff.
Referenced by open().
|
inline |
Returns whether the file is opened or not.
Definition at line 43 of file QVideoEncoder.h.
References m_isOpen.
Referenced by encodeImage().
|
protected |
Returns whether the image size is valid.
Definition at line 71 of file QVideoEncoder.cpp.
References m_height, and m_width.
Referenced by open().
| bool QVideoEncoder::open | ( | QString | formatShortName, |
| QStringList & | errors | ||
| ) |
Creates an (empty) video/anmiation file.
| formatShortName | output format (short name)
|
| errors | (if any) |
Definition at line 180 of file QVideoEncoder.cpp.
References cloudViewer_ff_const59, FFmpegStuffEnc::codecContext, FFmpegStuffEnc::formatContext, initFrame(), isSizeValid(), m_bitrate, m_ff, m_filename, m_fps, m_gop, m_height, m_isOpen, m_width, and FFmpegStuffEnc::videoStream.
|
protected |
Definition at line 69 of file QVideoEncoder.h.
Referenced by open().
|
protected |
FFmpeg variables.
Definition at line 75 of file QVideoEncoder.h.
Referenced by close(), convertImage_sws(), encodeImage(), freeFrame(), initFrame(), open(), and ~QVideoEncoder().
|
protected |
Definition at line 66 of file QVideoEncoder.h.
Referenced by open().
|
protected |
Definition at line 71 of file QVideoEncoder.h.
Referenced by open().
|
protected |
Definition at line 70 of file QVideoEncoder.h.
Referenced by open().
|
protected |
Definition at line 68 of file QVideoEncoder.h.
Referenced by convertImage_sws(), isSizeValid(), and open().
|
protected |
Definition at line 72 of file QVideoEncoder.h.
|
protected |
Definition at line 67 of file QVideoEncoder.h.
Referenced by convertImage_sws(), isSizeValid(), and open().