Use pad_len or pad_dur when you want to append a specified amount of silence; use whole_len or whole_dur when the output must reach at least a specified total length. The first choice adds to the input, while the second only fills a shortfall. Decide which duration contract you need before choosing an option, and set a length limit: without one, apad adds silence indefinitely.
Decide the duration contract and configure it
- Identify the requirement in plain language. “Append four seconds after every clip” means a fixed addition. “Make this track at least twelve seconds long” means a minimum total duration. Do not treat these as equivalent when the input duration can vary.
- Choose the matching unit and option. Use
pad_durorwhole_durto specify time; usepad_lenorwhole_lento specify a number of samples. The duration options accept FFmpeg time-duration syntax. Sample counts are not seconds, so use them only when your workflow specifies a sample count. - Set only one length option for this choice. FFmpeg documents
pad_lenandwhole_lenas mutually exclusive, as it doespad_durandwhole_dur. Apply the selectedapadoption to the intended audio stream in your filter workflow. - Determine how to handle inputs that already meet or exceed the target. A minimum is a floor, not a cap: a longer input does not need padding to satisfy it. A fixed addition is different: the specified silence is appended even when the input is already longer than a separate target you had in mind.
- Check the rendered audio’s actual duration against the chosen contract. For sample-based settings, use the output’s reported duration as a practical cross-check rather than assuming a sample count is itself a duration.
The official `apad` options distinguish silence to add from a minimum output length. The FFmpeg duration syntax reference explains accepted time values; consult it if a duration string is ambiguous.
Acceptance worksheet: hypothetical 8-second input
Assume the input audio is exactly 8 seconds. The table shows expected results from the documented meanings, not results from a software test. “At least 12 seconds” means 12 seconds is the floor, so the check should accept any output at or above it.
| Goal and input condition | Option | Expected final duration | Acceptance observation |
|---|---|---|---|
| Append exactly 4 seconds to an 8-second input | pad_dur=4 | 12 seconds | Confirm the tail adds 4 seconds to the original 8 |
| Reach at least 12 seconds from an 8-second input | whole_dur=12 | 12 seconds | Confirm the output reaches the floor |
| Reach at least 12 seconds from a hypothetical 14-second input | whole_dur=12 | At least 14 seconds | Confirm it remains longer than the floor; it is not shortened to 12 |
| Append 4 seconds to a hypothetical 14-second input | pad_dur=4 | 18 seconds | Confirm the fixed addition follows the longer input |
For your own delivery, record the input duration, selected option, target, and reported output duration. If the output is used alongside video, separately confirm the intended ending and whether another output-duration rule, such as -shortest, affects the final file.
Limits and what to do when the result fails
A frequent failure is omitting all four length controls. FFmpeg documents that apad then continues adding silence indefinitely; in a workflow that writes an output file, that can prevent the audio stream from reaching a natural end. Set an explicit length limit before relying on the filter.
If a minimum-duration output is unexpectedly longer than the target, first compare it with the input: a minimum does not trim audio that already exceeds the floor. If a fixed-tail output is too long, check whether you selected an addition option rather than a minimum option. If the reported duration is wrong for the requirement, verify the filter is applied to the intended stream and that the final file’s duration is being checked, not just the video timeline. The documentation describes -shortest as one use with apad for matching audio to video length; it does not make fixed addition and minimum length interchangeable.
FFmpeg’s documentation notes a version-specific caveat: in FFmpeg 4.4 and earlier, setting pad_dur or whole_dur to zero also caused indefinite padding. Avoid relying on zero as a way to request no padding in those versions; choose a positive, explicit target appropriate to the task.
Three quick questions
Does `whole_dur=12` make every output exactly 12 seconds? No. It sets a minimum. If the input is longer, the option does not shorten it.
Should I use seconds or samples? Use duration options when the requirement is expressed in time. Use sample-count options when the required addition or minimum is specified in samples; keep units explicit when reviewing the result.
What happens if I set neither a padding amount nor a minimum? The filter adds silence indefinitely according to the official documentation. Set a finite length option for a bounded output.
Sources and next step
This guide interprets public documentation and uses explicitly hypothetical acceptance examples, not application tests. Controls and availability can change; verify the cited manual against your installed version.
For work created in Imagild, carry the input requirements and acceptance checklist into the film workspace. The external software controls discussed above belong to their respective products.