mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add gif creation
This commit is contained in:
parent
5cc931fca0
commit
a7d568b375
@ -244,19 +244,48 @@ void Create::createVideoPreview(QString path, int frames, int frameRate)
|
|||||||
// Disable audio
|
// Disable audio
|
||||||
args.append("-an");
|
args.append("-an");
|
||||||
args.append("preview.mp4");
|
args.append("preview.mp4");
|
||||||
QScopedPointer<QProcess> pro(new QProcess());
|
QScopedPointer<QProcess> proConvertPreviewMP4(new QProcess());
|
||||||
|
|
||||||
pro.data()->setArguments(args);
|
proConvertPreviewMP4.data()->setArguments(args);
|
||||||
qDebug() << "Start converting video to preview";
|
qDebug() << "Start converting video to preview mp4";
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
pro.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg.exe");
|
proConvertPreviewMP4.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg.exe");
|
||||||
#endif
|
#endif
|
||||||
pro.data()->start();
|
proConvertPreviewMP4.data()->start();
|
||||||
pro.data()->waitForFinished(-1);
|
proConvertPreviewMP4.data()->waitForFinished(-1);
|
||||||
qDebug() << pro.data()->program() << pro.data()->arguments();
|
qDebug() << proConvertPreviewMP4.data()->program() << proConvertPreviewMP4.data()->arguments();
|
||||||
qDebug() << "Done converting video to preview" << pro.data()->readAll() << "\n"
|
qDebug() << "Done converting video to preview" << proConvertPreviewMP4.data()->readAll() << "\n"
|
||||||
<< pro.data()->readAllStandardError();
|
<< proConvertPreviewMP4.data()->readAllStandardError();
|
||||||
pro.data()->close();
|
proConvertPreviewMP4.data()->close();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Create gif
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
args.clear();
|
||||||
|
args.append("-y");
|
||||||
|
args.append("-stats");
|
||||||
|
args.append("-i");
|
||||||
|
args.append("preview.mp4");
|
||||||
|
args.append("-filter_complex");
|
||||||
|
args.append("[0:v] fps=12,scale=w=480:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1");
|
||||||
|
args.append("preview.gif");
|
||||||
|
|
||||||
|
QScopedPointer<QProcess> proConvertGif(new QProcess());
|
||||||
|
proConvertGif.data()->setArguments(args);
|
||||||
|
qDebug() << "Start converting video to preview gif";
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
proConvertGif.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg.exe");
|
||||||
|
#endif
|
||||||
|
proConvertGif.data()->start();
|
||||||
|
proConvertGif.data()->waitForFinished(-1);
|
||||||
|
qDebug() << proConvertGif.data()->program() << proConvertGif.data()->arguments();
|
||||||
|
qDebug() << "Done converting video to preview" << proConvertGif.data()->readAll() << "\n"
|
||||||
|
<< proConvertGif.data()->readAllStandardError();
|
||||||
|
proConvertGif.data()->close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user