diff --git a/core_lib/src/movieexporter.cpp b/core_lib/src/movieexporter.cpp index 9b6e4cda81..d3d722edcd 100644 --- a/core_lib/src/movieexporter.cpp +++ b/core_lib/src/movieexporter.cpp @@ -166,7 +166,7 @@ Status MovieExporter::assembleAudio(const Object* obj, QDir dir(mTempWorkDir); Q_ASSERT(dir.exists()); - QString tempAudioPath = mTempWorkDir + "/tmpaudio0.wav"; + QString tempAudioPath = QDir(mTempWorkDir).filePath("tmpaudio.wav"); qDebug() << "TempAudio=" << tempAudioPath; std::vector< SoundClip* > allSoundClips; @@ -180,6 +180,8 @@ Status MovieExporter::assembleAudio(const Object* obj, }); } + if (allSoundClips.empty()) return Status::SAFE; + int clipCount = 0; QString strCmd, filterComplex, amergeInput, panChannelLayout; @@ -218,7 +220,7 @@ Status MovieExporter::assembleAudio(const Object* obj, strCmd += QString(" -ss %1").arg((startFrame - 1) / static_cast(fps)); strCmd += QString(" -to %1").arg(endFrame / static_cast(fps)); // Output path - strCmd += " " + mTempWorkDir + "/tmpaudio.wav"; + strCmd += " " + tempAudioPath; STATUS_CHECK(MovieExporter::executeFFmpeg(strCmd, [&progress, this] (int frame) { progress(frame / static_cast(mDesc.endFrame - mDesc.startFrame)); return !mCanceled; })) qDebug() << "audio file: " + tempAudioPath; @@ -299,7 +301,7 @@ Status MovieExporter::generateMovie( // Build FFmpeg command //int exportFps = mDesc.videoFps; - const QString tempAudioPath = mTempWorkDir + "/tmpaudio.wav"; + const QString tempAudioPath = QDir(mTempWorkDir).filePath("tmpaudio.wav"); QString strCmd = QString("\"%1\"").arg(ffmpegPath); strCmd += QString(" -f rawvideo -pixel_format bgra"); diff --git a/core_lib/src/movieimporter.cpp b/core_lib/src/movieimporter.cpp index 125f26d76b..bc35da131f 100644 --- a/core_lib/src/movieimporter.cpp +++ b/core_lib/src/movieimporter.cpp @@ -219,7 +219,7 @@ Status MovieImporter::importMovieVideo(const QString &filePath, int fps, int fra QString strCmd = QString("\"%1\"").arg(ffmpegPath); strCmd += QString(" -i \"%1\"").arg(filePath); strCmd += QString(" -r %1").arg(fps); - strCmd += QString(" \"%1\"").arg(mTempDir->filePath("%05d.png")); + strCmd += QString(" \"%1\"").arg(QDir(mTempDir->path()).filePath("%05d.png")); status = MovieExporter::executeFFmpeg(strCmd, [&progress, frameEstimate, this] (int frame) { progress(qFloor(qMin(frame / static_cast(frameEstimate), 1.0) * 50)); return !mCanceled; } @@ -243,8 +243,9 @@ Status MovieImporter::generateFrames(std::function progress) Layer* layer = mEditor->layers()->currentLayer(); Status status = Status::OK; int i = 1; - auto amountOfFrames = QDir(mTempDir->path()).count(); - QString currentFile(mTempDir->filePath(QString("%1.png").arg(i, 5, 10, QChar('0')))); + QDir tempDir(mTempDir->path()); + auto amountOfFrames = tempDir.count(); + QString currentFile(tempDir.filePath(QString("%1.png").arg(i, 5, 10, QChar('0')))); QPoint imgTopLeft; ViewManager* viewMan = mEditor->view(); @@ -269,10 +270,10 @@ Status MovieImporter::generateFrames(std::function progress) if (mCanceled) return Status::CANCELED; progress(qFloor(50 + i / static_cast(amountOfFrames) * 50)); i++; - currentFile = mTempDir->filePath(QString("%1.png").arg(i, 5, 10, QChar('0'))); + currentFile = tempDir.filePath(QString("%1.png").arg(i, 5, 10, QChar('0'))); } - if (!QFileInfo::exists(mTempDir->filePath("00001.png"))) { + if (!QFileInfo::exists(tempDir.filePath("00001.png"))) { status = Status::FAIL; status.setTitle(tr("Failed import")); status.setDescription(tr("Was unable to find internal files, import unsucessful.")); @@ -309,7 +310,7 @@ Status MovieImporter::importMovieAudio(const QString& filePath, std::functionfilePath("audio.wav"); + QString audioPath = QDir(mTempDir->path()).filePath("audio.wav"); QString ffmpegPath = ffmpegLocation(); QString strCmd = QString("\"%1\"").arg(ffmpegPath);