Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
movieexporter.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2012-2017 Matthew Chiawen Chang
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 */
16 
17 #ifndef MOVIEEXPORTER_H
18 #define MOVIEEXPORTER_H
19 
20 #include <functional>
21 #include <QString>
22 #include <QSize>
23 #include <QTemporaryDir>
24 #include "pencilerror.h"
25 
26 class Object;
27 
29 {
30  QString strFileName;
31  int startFrame = 0;
32  int endFrame = 0;
33  //int videoFps = 30;
34  int fps = 12;
35  QSize exportSize{ 0, 0 };
36  QString strCameraName;
37 };
38 
40 {
41 public:
42  MovieExporter();
43  ~MovieExporter();
44 
45  Status run( const Object* obj,
46  const ExportMovieDesc& desc,
47  std::function<void(float)> progress );
48  QString error();
49 
50  void cancel() { mCanceled = true; }
51 
52 private:
53  Status assembleAudio( const Object* obj, QString ffmpegPath, std::function<void( float )> progress );
54  Status generateImageSequence( const Object* obj, std::function<void(float)> progress );
55  Status combineVideoAndAudio( QString ffmpegPath, QString strOutputFile );
56 
57  Status twoPassEncoding( QString ffmpeg, QString strOutputFile );
58  Status convertVideoAgain( QString ffmpeg, QString strIn, QString strOut );
59  Status convertToGif( QString ffmpeg, QString strIn, QString strOut );
60 
61  Status executeFFMpegCommand( QString strCmd );
62  Status checkInputParameters( const ExportMovieDesc& );
63 
64  QTemporaryDir mTempDir;
65  QString mTempWorkDir;
66  ExportMovieDesc mDesc;
67  bool mCanceled = false;
68 };
69 
70 #endif // MOVIEEXPORTER_H
Definition: object.h:71