fix: bound the audio-less clip bed with atrim (the card bed was fixed; this branch was missed by a silent no-op replace)

This commit is contained in:
glass beadian 2026-10-16 22:27:09 +00:00
parent 8401aa3d37
commit f3631307aa

View file

@ -143,7 +143,12 @@ export function clipVideoChain(rotate: EdlRotate, fit: "cover" | "contain", aspe
function clipAudioChain(volumeDb: number, hasAudio: boolean, inputIndex: number, trimSpanSec: string): string {
const aformat = `aformat=sample_fmts=fltp:sample_rates=${ASSEMBLE_PRESET.sampleRate}:channel_layouts=stereo`;
if (!hasAudio) return `anullsrc=r=${ASSEMBLE_PRESET.sampleRate}:cl=stereo,aformat=sample_fmts=fltp:sample_rates=${ASSEMBLE_PRESET.sampleRate}:channel_layouts=stereo`;
if (!hasAudio) {
// anullsrc is an INFINITE source — unbounded, concat never finishes the
// segment and the encode deadlocks (2026-10-16 production hang). atrim pins
// the bed to the clip's trim span; asetpts restarts timestamps.
return `anullsrc=r=${ASSEMBLE_PRESET.sampleRate}:cl=stereo,atrim=0:${trimSpanSec},asetpts=PTS-STARTPTS,aformat=sample_fmts=fltp:sample_rates=${ASSEMBLE_PRESET.sampleRate}:channel_layouts=stereo`;
}
return `[${inputIndex}:a]${aformat}${volumeDb === 0 ? "" : `,volume=${volumeDb}dB`}`;
}