1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 16:32:33 +02:00

Fix missing m_length for webm import

This commit is contained in:
Elias Steurer 2021-01-07 19:27:06 +01:00
parent 74db71d036
commit f49fa0dccc

View File

@ -244,7 +244,8 @@ bool CreateImportVideo::analyzeWebmReadFrames(const QJsonObject& obj)
// If the video is to short
m_smallVideo = m_numberOfFrames < (m_framerate * 5);
qInfo() << m_numberOfFrames << m_framerate << m_smallVideo;
m_length = std::ceil(m_numberOfFrames / m_framerate); ;
qInfo() << m_numberOfFrames << m_framerate << m_smallVideo << m_length;
return true;
}
@ -386,24 +387,6 @@ bool CreateImportVideo::createWallpaperVideoPreview()
args.append(m_exportPath + "/preview.webm");
emit processOutput("ffmpeg " + Util::toString(args));
connect(m_process.get(), &QProcess::readyReadStandardOutput, this, [&]() {
QString tmpOut = m_process->readAllStandardOutput();
const auto tmpList = tmpOut.split(QRegExp("\\s+"), Qt::SplitBehaviorFlags::SkipEmptyParts);
if (tmpList.length() > 2) {
bool ok = false;
const float currentFrame = QString(tmpList.at(1)).toFloat(&ok);
if (!ok)
return;
const float progress = currentFrame / static_cast<float>((m_framerate * 5));
this->setProgress(progress);
}
emit processOutput(tmpOut);
});
const QString ffmpegOut = waitForFinished(args);
const QFile previewVideo(m_exportPath + "/preview.webm");
if (!previewVideo.exists() || !(previewVideo.size() > 0)) {