From f346ea5d9d8d5ac39892d53941334721c03d2847 Mon Sep 17 00:00:00 2001 From: Eris Fairbanks Date: Mon, 21 Dec 2020 21:32:32 -0500 Subject: [PATCH] Offsetting and trimming audio using audio filters instead of doing timestamp tricks. --- src/ShaderChain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ShaderChain.cpp b/src/ShaderChain.cpp index 00e1f6f..f710a38 100755 --- a/src/ShaderChain.cpp +++ b/src/ShaderChain.cpp @@ -582,7 +582,7 @@ void ShaderChain::saveVideo(string outputFilename) { if (fft.currentState == InputStateSoundFile) { string outputMp4AudioFilename = outputFilename + "_audio.mp4"; outputMp4AudioFilename = createUniqueFilePath(outputMp4AudioFilename); - string addSoundCommand = this->ffmpegCommand + " -i \"" + outputMp4Filename + "\" -itsoffset " + std::to_string(-this->pngRenderer->starttime) + " -i \"" + fft.soundFilePath + "\" -vcodec copy -acodec aac -shortest " + outputMp4AudioFilename; + string addSoundCommand = this->ffmpegCommand + " -i \"" + outputMp4Filename + "\" -i \"" + fft.soundFilePath + "\" -af atrim=start=" + std::to_string(this->pngRenderer->starttime) + ":duration=" + std::to_string(this->pngRenderer->animduration) + ",asetpts=PTS-STARTPTS -vcodec copy -acodec aac -shortest " + outputMp4AudioFilename; system(addSoundCommand.c_str()); outputMp4Filename = outputMp4AudioFilename; } -- 2.45.2