How can I solve audio delays when watching a movie on my computer?
Try this best video audio sync fixer for Windows/Mac to fix audio out of sync with video permanently.
"Why my audio is not in sync after re-encoding with FFmpeg? Can FFmpeg sync audio and video directly?"
--- A question from SuperUser
FFmpeg is a free and open-source programming project consisting of a set-up of libraries and projects that takes care of video, sound, and other media documents and streams. It becomes the best choice to convert, compress and edit video and audio files for free. You will never miss FFmpeg if you are looking for a totally free audio and video converter. But you may don’t know FFmpeg can also be used to fix issues of audio and video out of sync.
This article deals with the question of whether FFmpeg syncs audio and video or not and shows you the detailed steps and best alternative.
Part 1. Common Audio and Video Out of Sync Issues
Sound to-video synchronization (AV synchronization, otherwise called lip-sync, or by its absence: lip-sync blunder, lip fold) alludes to the overall planning of sound and video parts during creation, after creation (blending), transmission, gathering, and play-back handling. AV synchronization can be an issue in TV, videoconferencing, or film.
1. Audio Too Slow or Fast
It can simply be said that when playing a video, the audio either runs ahead of the video or it might run behind the video. The synchronization of audio with the video is disturbed, thereby, hindering the video-watching experience. It is a common problem that can be fixed in several ways; one such way is discussed in this article.
2. Audio Is Ahead
In the audio ahead of the video, the sound plays before the actions occur in the video. This issue can get quite frustrating as you have to concentrate on what the person is saying to match it with the video that runs afterward.
3. Audio Lags Behind
When sound can be heard after the action has taken place in the video, this kills all the excitement to view the video as a person might have to memorize the dialogue that is followed by the video. The best possible aspect is that the synchronization is perfect to enjoy and watch all sorts of videos and movies etc. This issue can be tackled in various ways. Read on to find out how to fix audio and video syncing issues in FFmpeg.
Part 2. How To Use FFmpeg Sync Audio and Video
To tackle the synchronization issue, firstly, we need to know its idea. Basically, all the sound and video out of sync issues reduce to this:
1. The sound is in ahead of the video (or the video behind the sound)
2. The sound is behind the video (or the video is ahead of the sound)
FFmpeg synchronize audio and video delay can be solved by the method followed in this article. Follow the step-by-step guidelines to tackle the issue.
1. Correct FFmpeg Sync Audio to Video That is Too Fast or Slow
You can easily do this by using the -async parameter of FFmpeg, which, as per the documentation "Stretches/squeezes" enables the sound stream to match the timestamps. The parameter takes a numeric value for the samples per second to fix the issue.
ffmpeg -async 25 -i input.mpg <encoding options> -r 25
Attempt gradually expanding the - async value until the sound and video are in sync.
2. Auto-Correcting Time-Shift
1) If Audio Lags Behind
Apart from dropping/duplicating frames in the video stream using -async, use -sync, there are other techniques you can try. These include "-sync 1" and "-sync 2," as well as an auto-detection approach using "-sync -1." However, you may specify the stream to sync against using "-map."
ffmpeg -vsync 1 -i input.mpg <encoding options>
ffmpeg -vsync 2 -i input.mpg <encoding options>
Surprisingly, Google displays individuals using -async and -vsync in the same sentence. As a consequence, it can be worthwhile to experiment a little to get the desired effect.
2) If Audio Is Ahead
When audio is ahead of the video, the -async option, when provided as -async 1, automatically corrects the start of the audio stream. Follow this syntax to sync the audio with the video.
ffmpeg -async 1 -i input.mpg <encoding options>
3. Manually Correcting Time-Shift
If the preceding repair doesn't work with a constantly shifting sound/video track, but you know the time shift that needs to be rectified, you can easily fix it with one of the following two commands:
1) If Audio Is Ahead
Example to shift by 3 seconds:
ffmpeg -i input.mp4 -itsoffset 00:00:03.0 -i input.mp4 -vcodec copy -acodec copy -map 0:1 -map 1:0 output_shift3s.mp4
Note how you indicate your feedback record twice with the first followed by a period offset. Later in the order, there are two - map parameters that tell FFmpeg to utilize the time-shifted video transfer from the first - I input.mp4 and the sound stream from the subsequent one.
Likewise, add the - vcodec copy- acodec copy to keep away from reencoding the video and free quality. These boundaries must be added later in the subsequent info document and before the mapping options. In any case, one runs into mapping errors.
2) If Audio Lags Behind
An example to shift by 3 seconds:
ffmpeg -i input.mp4 -itsoffset 00:00:03.0 -i input.mp4 -vcodec copy -acodec copy -map 1:0 -map 0:1 output_shift3s.mp4
Note how the order is almost indistinguishable from the past order except for the - map boundaries exchanged. So from the time-shifted first - i input.mp4, we presently take the sound rather than the video and consolidate it with the video.
Part 3. The Easiest FFmpeg Alternative to Sync Audio and Video
If you feel it is hard to use FFmpeg sync audio and video, here comes an easier tool for you - Wondershare UniConverter, which is not only an powerful video conveter but an easy to use video editor with multiple value-added features, such as Sync Audio, Smart Trim, Subtitle Editor, etc. Using Wondershare UniConverter, you can simply drag to adjust audio with video easily.
Sync audio and video permanently in simple clicks.
Rich audio editing choice, such as adjusting audio volume, enhance human voice, audio fade in and out, etc.
It supports converting video in over 1000 formats at 90X faster speed.
Compress your video files without quality loss.
Excellent smart trimmer for cutting and splitting videos automatically.
Nice AI-enabled subtitle editor for adding subtitles to your tutorial videos automatically.
How to Fix Audio Out of Sync Using Wondershare Uniconverter:
Step 1Launch Wondershare UniConverter and Import video files to fix audio out of sync
From the main interface of Wondershre UniConverter, click Video Editor Tab, you will find 6 editing features list here: Trim/Crop/Watermark/Effect/Subtitle/Audio. Click the Audio tab to open the file adding window. Choose your videos to import to this editor
Step 2Sync audio with video
Click to drag the slide bar below Master Audio Slider , you can drag forward to make the audio track ahead or backforward to make it delay. When all settings done, click OK.
Step 3Export synced videos.
Finally, choose your desired video format from the list of Output Format, and then click Save or Start All button to export your video.
It's irritating when your cherished FFmpeg abruptly begins playing out of sync. In any case, the best thing is that you can FFmpeg synchronize audio video delay. You can utilize different elements to sort out the FFmpeg sync audio and video desynchronization problem. FFmpeg can be a great tool to solve the issue with audio and video delay; another alternative is to use the Wondershare Uniconverter. Hopefully, this article has helped to address the issue and provided a way to solve it.
Full Video, Audio and Image Solutions for Camera Users
Still struggling with your shooting 4K video won't play on other devices or playing with audio and video out of sync? Wondershare UniConverter helps you out! Find your issues and get the full answer now.