Audio endpoint contract
An editor may need a four-second stem delivered on a six-second timeline so it can be dropped into a shared sequence without ambiguity. FFmpeg apad can extend sound, but an unbounded configuration can continue indefinitely, while a minimum-duration setting does not shorten an already longer input. The distinct artifact is an explicit endpoint policy that prevents a technically successful command from creating an unexpectedly long file or truncating a final word.
Build the evidence
- 01
Decide the endpoint before choosing options
Measure the actual source duration and listen to its complete end. Write down whether longer-than-target material should be preserved, rejected or intentionally trimmed. If the recording contains required sound after the target, padding is not the relevant operation; the editorial interval needs review. Also state the common timeline origin so a six-second stem is not mistakenly treated as six seconds beginning at a different source position.
- 02
Use bounded padding and explicit trimming
The example asks apad for a minimum total six-second program, then uses atrim to impose an exact six-second endpoint and asetpts to rebase timestamps. It therefore intentionally truncates an input longer than six seconds. Use it only under a contract that allows that truncation. If the requirement is minimum length while preserving an existing tail, omit the trim and verify the resulting duration instead of calling it an exact-length export.
- 03
Inspect samples, timing and intended silence
Reopen the saved WAV and check original content, the transition into silence and the final endpoint. Confirm that silence occupies only the intended added region. Where picture is involved, import the actual delivered stem against the approved video and verify early and late anchors. Encoding to AAC afterward creates a new delivery artifact whose packet-level duration can differ slightly; do not mistake that wrapper behavior for newly spoken content.
A bounded example
Local executed example: a synthetic four-second sample-cut WAV was extended and trimmed to six seconds with the stated filter chain under FFmpeg 7.1. The command completed successfully. The tones were not dialogue or room ambience, so the test validates bounded processing rather than perceptual seam quality. A real handoff should include a note that the final two seconds are intentional digital silence, not an accidentally absent recording. The delivery note should identify where the original content ends and where intentionally added empty samples begin.
Local diagnostic commands
The exact-length filter chain was executed on a local four-second synthetic WAV under FFmpeg 7.1. The minimum-length alternative is a documentation example; no human audio or paid generation was tested.
# EXACT six seconds: this also truncates longer input; use only if approved.
ffmpeg -n -i approved-stem.wav -af "apad=whole_dur=6,atrim=duration=6,asetpts=PTS-STARTPTS" -c:a pcm_s24le exact-six.wav
# MINIMUM six seconds: preserves an input that is already longer.
ffmpeg -n -i approved-stem.wav -af "apad=whole_dur=6" -c:a pcm_s24le minimum-six.wavAudio endpoint contract
| Requirement | Policy | Potential mistake |
|---|---|---|
| Minimum length | Pad shorter input; keep longer content | Assuming it enforces an exact end |
| Exact length | Pad then approved trim | Cutting required final sound |
| Ambience continuity | Use suitable recorded material | Calling empty samples room tone |
Acceptance evidence
- The endpoint policy distinguishes minimum duration from exact duration.
- Any permission to truncate a longer input is written explicitly.
- Added silence is labeled in the delivery manifest and verified by listening.
- Picture alignment and final encoded duration receive separate checks.
Stop condition
Stop if the added region needs real ambience, speech or music rather than empty samples. Obtain appropriate authorized material or revise the edit. Do not hide a missing ending behind padding, and never leave an indefinitely padded audio process running without a deliberate terminating condition in the output workflow.
