M src/ShaderChain.cpp => src/ShaderChain.cpp +1 -1
@@ 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;
}