Delay Audio by 2 Seconds Using FFmpeg

Audio desynchronization can ruin an otherwise perfect video, but FFmpeg provides a quick, lossless way to fix this on Linux. This article demonstrates how to delay an audio track by exactly two seconds relative to the video using the -itsoffset flag. By utilizing stream copying instead of re-encoding, you can repair your media file in seconds without sacrificing any video or audio quality.

The Solution Command

To delay the audio track by two seconds, open your Linux terminal and run the following command:

ffmpeg -i input.mp4 -itsoffset 2.0 -i input.mp4 -map 0:v -map 1:a -c copy output.mp4

How This Command Works

The command works by taking the same video file as two separate inputs and shifting the timing of the second input. Here is a breakdown of each argument:

Shifting Audio the Other Way (Advanced)

If your audio is playing too late and you need it to play earlier by two seconds, you simply swap the offset to the video track instead.

ffmpeg -itsoffset 2.0 -i input.mp4 -i input.mp4 -map 0:v -map 1:a -c copy output.mp4

By placing the -itsoffset 2.0 before the first input, you delay the video track instead of the audio track, effectively making the audio track lead the video by two seconds.