How do I measure and fix a constant audio offset in an edit with FFmpeg (-itsoffset, adelay, aresample async), and what does each tool actually change?
Problem: separately generated or dubbed audio lands early or late against picture. Conditions: a CONSTANT offset has been measured (clap/flash marker, or a transient in both streams); drift is a different problem. Method (all statements from the FFmpeg docs unless marked): -itsoffset is an input option; the offset is added to the input's timestamps and a positive value delays that input's streams, so place it before the -i of the audio file to delay audio (a negative value to advance it is my inference from 'added to the timestamps'; test it). The adelay filter delays selected channels and fills the gap with silence; delays are in milliseconds per channel separated by '|', with an S suffix for exact samples and 'all=1' to apply the last delay to all remaining channels, e.g. adelay=delays=64S:all=1. aresample with async can stretch/squeeze samples to follow timestamps (docs example async=1000, maximum 1000 samples per second of compensation), which is a drift-handling tool, not an of...
Structured fields
{
"citations": [
{
"url": "https://ffmpeg.org/ffmpeg.html",
"note": "-itsoffset offset (input); 8.12 adelay; 8.47.1 aresample examples"
},
{
"url": "https://ffmpeg.org/ffmpeg-filters.html",
"note": "-itsoffset offset (input); 8.12 adelay; 8.47.1 aresample examples"
}
]
}Evidence claims
- [sourced_fact] Problem: separately generated or dubbed audio lands early or late against picture. Conditions: a CONSTANT offset has been measured (clap/flash marker, or a transient in both streams); drift is a different problem. Method (all statements from the FFmpeg docs unless marked): -itsoffset is an input option; the offset is added to the input's timestamps and a positive value delays that input's streams, so place it before the -i of the audio file to delay audio (a negative value to advance it is my inference from 'added to the timestamps'; test it). The adelay filter delays selected channels and fills the gap with silence; delays are in milliseconds per channel separated by '|', with an S suffix for exact samples and 'all=1' to apply the last delay to all remaining channels, e.g. adelay=delays=64S:all=1. aresample with async can stretch/squeeze samples to follow timestamps (docs example async=1000, maximum 1000 samples per second of compensation), which is a drift-handling tool, not an offset tool. Workflow (inference): measure offset in ms at two points (start and end) to tell constant offset from drift; apply -itsoffset or adelay for constant; for drift fix the cause (frame-rate mismatch, VFR source) rather than stretching speech; re-measure on the exported file, because muxers and edit lists can re-introduce start offsets. Failure modes: adelay cannot advance audio (it only adds silence); delaying one channel of a stereo or multichannel stem breaks phase relationships; async stretching changes pitch/timing of dialogue; applying -itsoffset to the wrong input. Limitations: docs pages are undated and track the current FFmpeg release; behaviour of -itsoffset with copied streams and some containers is not spelled out there. · locator: -itsoffset offset (input); 8.12 adelay; 8.47.1 aresample examples source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |