Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use amerge when exporting a single audio clip #1775

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions core_lib/src/movieexporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,22 @@ Status MovieExporter::assembleAudio(const Object* obj,
panChannelLayout.chop(1);
// Output arguments
// Mix audio
args << "-filter_complex" << QString("%1%2 amerge=inputs=%3, pan=mono|c0=%4 [out]")
.arg(filterComplex).arg(amergeInput).arg(clipCount).arg(panChannelLayout);
args << "-filter_complex";
if (clipCount == 1)
{
// If there is only one sound clip there is no need to use amerge
// Prior to ffmpeg 3.2, amerge does not support inputs=1
filterComplex.chop(1); // Remove final semicolon since there are no more filters added after
args << filterComplex << "-map" << amergeInput;
}
else {
args << QString("%1%2 amerge=inputs=%3, pan=mono|c0=%4 [out]")
.arg(filterComplex).arg(amergeInput).arg(clipCount).arg(panChannelLayout);
args << "-map" << "[out]";
}
// Convert audio file: 44100Hz sampling rate, stereo, signed 16 bit little endian
// Supported audio file types: wav, mp3, ogg... ( all file types supported by ffmpeg )
args << "-ar" << "44100" << "-acodec" << "pcm_s16le" << "-ac" << "2" << "-map" << "[out]" << "-y";
args << "-ar" << "44100" << "-acodec" << "pcm_s16le" << "-ac" << "2" << "-y";
// Trim audio
args << "-ss" << QString::number((startFrame - 1) / static_cast<double>(fps));
args << "-to" << QString::number(endFrame / static_cast<double>(fps));
Expand Down
Loading