Hello i have a problem with a bunch of videos. The audio is not synchron to the video. I tried to fix it with the help of chatgpt. I asked chatgpt to summarize what we did so far. If anyone have an idea that would be great. And sorry for my english 😥
CHATGPT:
I'm trying to diagnose and fix an audio/video synchronization problem in an MP4 file using FFmpeg on Windows. I've already tried several common solutions, but none of them have fixed the problem. I'd appreciate help identifying the underlying cause before attempting further corrections.
For now, I want to focus on one file only: Testvid.mp4. If I can get this file working correctly, I can investigate whether the same solution applies to my other videos later.
1. Symptoms
The audio and video appear to be out of sync.
What I have observed so far:
- The video starts with an introductory music section.
- When people begin speaking, their lip movements appear to occur approximately 2–3 seconds before the corresponding audio.
- It is not yet established whether the offset remains constant, gradually increases over time, or changes abruptly at a particular point.
I want to determine whether this is caused by incorrect timestamps, a timing problem within the streams, an encoding issue, or something else.
2. Media Information
The following information was obtained using FFprobe for Testvid.mp4.
Video stream:
- Codec: H.264
- Resolution: 640 × 480
- Frame rate: 25 FPS
- Duration: 1352.04 seconds (22 minutes, 32.04 seconds)
- Number of frames: 33,801
- Start time: 0 seconds
Audio stream:
- Codec: AAC
- Sample rate: 44,100 Hz
- Channels: 2 (stereo)
- Duration: 1440.809002 seconds (approximately 24 minutes, 0.81 seconds)
- Start time: 0 seconds
Container:
- Reported duration: approximately 1440.81 seconds
The audio stream is therefore approximately 88.77 seconds longer than the video stream.
Both streams reportedly start at timestamp 0. However, I understand that this does not necessarily mean that the actual audio and video content is synchronized.
3. FFmpeg Tests Already Performed
I have tried the following approaches. None of them successfully resolved the synchronization problem.
Test 1: Re-encoding with generated timestamps
ffmpeg -fflags +genpts -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a aac -b:a 192k -fps_mode passthrough "test_repaired.mp4"
Result: The synchronization problem remained.
Test 2: Delaying the audio by two seconds
ffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]adelay=2000|2000[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_delayed.mp4"
Result: This did not produce the desired synchronization.
Test 3: Changing the audio playback speed
ffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]atempo=1.06566,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_tempo.mp4"
Result: The synchronization was still incorrect.
Test 4: Remuxing without re-encoding
ffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy "test_remux.mp4"
Result: Remuxing alone did not fix the problem.
Test 5: Slowing down the video
ffmpeg -i "Testvid.mp4" -vf "setpts=1.06566*PTS" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a copy -fps_mode vfr -shortest "test_video_slower.mp4"
Result: This did not resolve the synchronization problem either.
Test 6: Creating a 60-second test clip
ffmpeg -i "Testvid.mp4" -t 60 -map 0:v:0 -map 0:a:0 -c:v libx264 -preset ultrafast -crf 23 -c:a aac -b:a 128k "test_60sec.mp4"
Result: This did not provide a satisfactory solution.
4. Additional Diagnostic Findings
I also ran FFmpeg to decode the file and process the streams without producing an output video file.
The command used for the original file was:
ffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy -f null NUL
The file was also processed in a separate decoding test. The output did not show obvious Error, Invalid, or Warning messages.
FFmpeg reported processing 33,801 video frames. Interestingly, its final progress timestamp was approximately 24 minutes, even though FFprobe reported a video stream duration of only 22 minutes and 32 seconds.
I do not know whether this discrepancy is significant or simply a consequence of how FFmpeg reports progress for multiple streams.
FFplay was also tested, but it did not solve the problem. A few isolated A/V difference readings were approximately -0.002 and 0.125 seconds. These readings were insufficient to establish the cause.
5. What I Would Like Help With
Rather than trying additional arbitrary audio delays or speed adjustments, I would like to understand the actual timing problem.
Specifically, I would appreciate advice on how to:
- Inspect the audio and video packet timestamps, including PTS and DTS.
- Examine the actual video frame timestamps and determine whether they are consistent with a 25 FPS stream.
- Compare the audio packet timestamps and audio sample timing against the video timeline.
- Determine why FFprobe reports a video duration of 1352.04 seconds while the audio and container durations are approximately 1440.81 seconds.
- Establish whether the discrepancy is caused by incorrect timestamps, an unusual stream time base, missing or duplicated timestamps, an encoding problem, or another issue.
- Identify a reliable way to repair the file without unnecessarily degrading its quality.
I am using FFmpeg on Windows. My FFmpeg build is a recent full build from gyan.dev.
I am happy to run additional FFprobe or FFmpeg diagnostic commands and share their output.
The important point is that I want to identify the cause first, then apply a correction based on the measured timing data. Simply changing the audio or video speed based on the difference between their reported durations has not worked so far.
Thanks in advance for any suggestions.FFmpeg: Severe Audio/Video Desynchronization in MP4 — Different Stream Durations, Need Help Diagnosing the CauseHello everyone,I'm trying to diagnose and fix an audio/video synchronization problem in an MP4 file using FFmpeg on Windows. I've already tried several common solutions, but none of them have fixed the problem. I'd appreciate help identifying the underlying cause before attempting further corrections.For now, I want to focus on one file only: Testvid.mp4. If I can get this file working correctly, I can investigate whether the same solution applies to my other videos later.1. SymptomsThe audio and video appear to be out of sync.What I have observed so far:The video starts with an introductory music section.
When people begin speaking, their lip movements appear to occur approximately 2–3 seconds before the corresponding audio.
It is not yet established whether the offset remains constant, gradually increases over time, or changes abruptly at a particular point.I want to determine whether this is caused by incorrect timestamps, a timing problem within the streams, an encoding issue, or something else.2. Media InformationThe following information was obtained using FFprobe for Testvid.mp4.Video stream:Codec: H.264
Resolution: 640 × 480
Frame rate: 25 FPS
Duration: 1352.04 seconds (22 minutes, 32.04 seconds)
Number of frames: 33,801
Start time: 0 secondsAudio stream:Codec: AAC
Sample rate: 44,100 Hz
Channels: 2 (stereo)
Duration: 1440.809002 seconds (approximately 24 minutes, 0.81 seconds)
Start time: 0 secondsContainer:Reported duration: approximately 1440.81 secondsThe audio stream is therefore approximately 88.77 seconds longer than the video stream.Both streams reportedly start at timestamp 0. However, I understand that this does not necessarily mean that the actual audio and video content is synchronized.3. FFmpeg Tests Already PerformedI have tried the following approaches. None of them successfully resolved the synchronization problem.Test 1: Re-encoding with generated timestampsffmpeg -fflags +genpts -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a aac -b:a 192k -fps_mode passthrough "test_repaired.mp4"Result: The synchronization problem remained.Test 2: Delaying the audio by two secondsffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]adelay=2000|2000[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_delayed.mp4"Result: This did not produce the desired synchronization.Test 3: Changing the audio playback speedffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]atempo=1.06566,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_tempo.mp4"Result: The synchronization was still incorrect.Test 4: Remuxing without re-encodingffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy "test_remux.mp4"Result: Remuxing alone did not fix the problem.Test 5: Slowing down the videoffmpeg -i "Testvid.mp4" -vf "setpts=1.06566*PTS" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a copy -fps_mode vfr -shortest "test_video_slower.mp4"Result: This did not resolve the synchronization problem either.Test 6: Creating a 60-second test clipffmpeg -i "Testvid.mp4" -t 60 -map 0:v:0 -map 0:a:0 -c:v libx264 -preset ultrafast -crf 23 -c:a aac -b:a 128k "test_60sec.mp4"Result: This did not provide a satisfactory solution.4. Additional Diagnostic FindingsI also ran FFmpeg to decode the file and process the streams without producing an output video file.The command used for the original file was:ffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy -f null NULThe file was also processed in a separate decoding test. The output did not show obvious Error, Invalid, or Warning messages.FFmpeg reported processing 33,801 video frames. Interestingly, its final progress timestamp was approximately 24 minutes, even though FFprobe reported a video stream duration of only 22 minutes and 32 seconds.I do not know whether this discrepancy is significant or simply a consequence of how FFmpeg reports progress for multiple streams.FFplay was also tested, but it did not solve the problem. A few isolated A/V difference readings were approximately -0.002 and 0.125 seconds. These readings were insufficient to establish the cause.5. What I Would Like Help WithRather than trying additional arbitrary audio delays or speed adjustments, I would like to understand the actual timing problem.Specifically, I would appreciate advice on how to:Inspect the audio and video packet timestamps, including PTS and DTS.
Examine the actual video frame timestamps and determine whether they are consistent with a 25 FPS stream.
Compare the audio packet timestamps and audio sample timing against the video timeline.
Determine why FFprobe reports a video duration of 1352.04 seconds while the audio and container durations are approximately 1440.81 seconds.
Establish whether the discrepancy is caused by incorrect timestamps, an unusual stream time base, missing or duplicated timestamps, an encoding problem, or another issue.
Identify a reliable way to repair the file without unnecessarily degrading its quality.I am using FFmpeg on Windows. My FFmpeg build is a recent full build from gyan.dev.I am happy to run additional FFprobe or FFmpeg diagnostic commands and share their output.The important point is that I want to identify the cause first, then apply a correction based on the measured timing data. Simply changing the audio or video speed based on the difference between their reported durations has not worked so far.Thanks in advance for any suggestions.Hello i have a problem with a bunch of videos. The audio is not synchron to the video. I tried to fix it with the help of chatgpt. I asked chatgpt to summarize what we did so far. If anyone have an idea that would be great. And sorry for my english 😥CHATGPT:I'm trying to diagnose and fix an audio/video synchronization problem in an MP4 file using FFmpeg on Windows. I've already tried several common solutions, but none of them have fixed the problem. I'd appreciate help identifying the underlying cause before attempting further corrections.For now, I want to focus on one file only: Testvid.mp4. If I can get this file working correctly, I can investigate whether the same solution applies to my other videos later.1. SymptomsThe audio and video appear to be out of sync.What I have observed so far:The video starts with an introductory music section.
When people begin speaking, their lip movements appear to occur approximately 2–3 seconds before the corresponding audio.
It is not yet established whether the offset remains constant, gradually increases over time, or changes abruptly at a particular point.I want to determine whether this is caused by incorrect timestamps, a timing problem within the streams, an encoding issue, or something else.2. Media InformationThe following information was obtained using FFprobe for Testvid.mp4.Video stream:Codec: H.264
Resolution: 640 × 480
Frame rate: 25 FPS
Duration: 1352.04 seconds (22 minutes, 32.04 seconds)
Number of frames: 33,801
Start time: 0 secondsAudio stream:Codec: AAC
Sample rate: 44,100 Hz
Channels: 2 (stereo)
Duration: 1440.809002 seconds (approximately 24 minutes, 0.81 seconds)
Start time: 0 secondsContainer:Reported duration: approximately 1440.81 secondsThe audio stream is therefore approximately 88.77 seconds longer than the video stream.Both streams reportedly start at timestamp 0. However, I understand that this does not necessarily mean that the actual audio and video content is synchronized.3. FFmpeg Tests Already PerformedI have tried the following approaches. None of them successfully resolved the synchronization problem.Test 1: Re-encoding with generated timestampsffmpeg -fflags +genpts -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a aac -b:a 192k -fps_mode passthrough "test_repaired.mp4"Result: The synchronization problem remained.Test 2: Delaying the audio by two secondsffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]adelay=2000|2000[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_delayed.mp4"Result: This did not produce the desired synchronization.Test 3: Changing the audio playback speedffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]atempo=1.06566,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_tempo.mp4"Result: The synchronization was still incorrect.Test 4: Remuxing without re-encodingffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy "test_remux.mp4"Result: Remuxing alone did not fix the problem.Test 5: Slowing down the videoffmpeg -i "Testvid.mp4" -vf "setpts=1.06566*PTS" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a copy -fps_mode vfr -shortest "test_video_slower.mp4"Result: This did not resolve the synchronization problem either.Test 6: Creating a 60-second test clipffmpeg -i "Testvid.mp4" -t 60 -map 0:v:0 -map 0:a:0 -c:v libx264 -preset ultrafast -crf 23 -c:a aac -b:a 128k "test_60sec.mp4"Result: This did not provide a satisfactory solution.4. Additional Diagnostic FindingsI also ran FFmpeg to decode the file and process the streams without producing an output video file.The command used for the original file was:ffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy -f null NULThe file was also processed in a separate decoding test. The output did not show obvious Error, Invalid, or Warning messages.FFmpeg reported processing 33,801 video frames. Interestingly, its final progress timestamp was approximately 24 minutes, even though FFprobe reported a video stream duration of only 22 minutes and 32 seconds.I do not know whether this discrepancy is significant or simply a consequence of how FFmpeg reports progress for multiple streams.FFplay was also tested, but it did not solve the problem. A few isolated A/V difference readings were approximately -0.002 and 0.125 seconds. These readings were insufficient to establish the cause.5. What I Would Like Help WithRather than trying additional arbitrary audio delays or speed adjustments, I would like to understand the actual timing problem.Specifically, I would appreciate advice on how to:Inspect the audio and video packet timestamps, including PTS and DTS.
Examine the actual video frame timestamps and determine whether they are consistent with a 25 FPS stream.
Compare the audio packet timestamps and audio sample timing against the video timeline.
Determine why FFprobe reports a video duration of 1352.04 seconds while the audio and container durations are approximately 1440.81 seconds.
Establish whether the discrepancy is caused by incorrect timestamps, an unusual stream time base, missing or duplicated timestamps, an encoding problem, or another issue.
Identify a reliable way to repair the file without unnecessarily degrading its quality.I am using FFmpeg on Windows. My FFmpeg build is a recent full build from gyan.dev.I am happy to run additional FFprobe or FFmpeg diagnostic commands and share their output.The important point is that I want to identify the cause first, then apply a correction based on the measured timing data. Simply changing the audio or video speed based on the difference between their reported durations has not worked so far.Thanks in advance for any suggestions.FFmpeg: Severe Audio/Video Desynchronization in MP4 — Different Stream Durations, Need Help Diagnosing the CauseHello everyone,I'm trying to diagnose and fix an audio/video synchronization problem in an MP4 file using FFmpeg on Windows. I've already tried several common solutions, but none of them have fixed the problem. I'd appreciate help identifying the underlying cause before attempting further corrections.For now, I want to focus on one file only: Testvid.mp4. If I can get this file working correctly, I can investigate whether the same solution applies to my other videos later.1. SymptomsThe audio and video appear to be out of sync.What I have observed so far:The video starts with an introductory music section.When people begin speaking, their lip movements appear to occur approximately 2–3 seconds before the corresponding audio.It is not yet established whether the offset remains constant, gradually increases over time, or changes abruptly at a particular point.I want to determine whether this is caused by incorrect timestamps, a timing problem within the streams, an encoding issue, or something else.2. Media InformationThe following information was obtained using FFprobe for Testvid.mp4.Video stream:Codec: H.264Resolution: 640 × 480Frame rate: 25 FPSDuration: 1352.04 seconds (22 minutes, 32.04 seconds)Number of frames: 33,801Start time: 0 secondsAudio stream:Codec: AACSample rate: 44,100 HzChannels: 2 (stereo)Duration: 1440.809002 seconds (approximately 24 minutes, 0.81 seconds)Start time: 0 secondsContainer:Reported duration: approximately 1440.81 secondsThe audio stream is therefore approximately 88.77 seconds longer than the video stream.Both streams reportedly start at timestamp 0. However, I understand that this does not necessarily mean that the actual audio and video content is synchronized.3. FFmpeg Tests Already PerformedI have tried the following approaches. None of them successfully resolved the synchronization problem.Test 1: Re-encoding with generated timestampsffmpeg -fflags +genpts -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a aac -b:a 192k -fps_mode passthrough "test_repaired.mp4"Result: The synchronization problem remained.Test 2: Delaying the audio by two secondsffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]adelay=2000|2000[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_delayed.mp4"Result: This did not produce the desired synchronization.Test 3: Changing the audio playback speedffmpeg -i "Testvid.mp4" -filter_complex "[0:a:0]atempo=1.06566,asetpts=PTS-STARTPTS[a]" -map 0:v:0 -map "[a]" -c:v copy -c:a aac -b:a 192k -shortest "test_audio_tempo.mp4"Result: The synchronization was still incorrect.Test 4: Remuxing without re-encodingffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy "test_remux.mp4"Result: Remuxing alone did not fix the problem.Test 5: Slowing down the videoffmpeg -i "Testvid.mp4" -vf "setpts=1.06566*PTS" -map 0:v:0 -map 0:a:0 -c:v libx264 -preset veryfast -crf 18 -c:a copy -fps_mode vfr -shortest "test_video_slower.mp4"Result: This did not resolve the synchronization problem either.Test 6: Creating a 60-second test clipffmpeg -i "Testvid.mp4" -t 60 -map 0:v:0 -map 0:a:0 -c:v libx264 -preset ultrafast -crf 23 -c:a aac -b:a 128k "test_60sec.mp4"Result: This did not provide a satisfactory solution.4. Additional Diagnostic FindingsI also ran FFmpeg to decode the file and process the streams without producing an output video file.The command used for the original file was:ffmpeg -i "Testvid.mp4" -map 0:v:0 -map 0:a:0 -c copy -f null NULThe file was also processed in a separate decoding test. The output did not show obvious Error, Invalid, or Warning messages.FFmpeg reported processing 33,801 video frames. Interestingly, its final progress timestamp was approximately 24 minutes, even though FFprobe reported a video stream duration of only 22 minutes and 32 seconds.I do not know whether this discrepancy is significant or simply a consequence of how FFmpeg reports progress for multiple streams.FFplay was also tested, but it did not solve the problem. A few isolated A/V difference readings were approximately -0.002 and 0.125 seconds. These readings were insufficient to establish the cause.5. What I Would Like Help WithRather than trying additional arbitrary audio delays or speed adjustments, I would like to understand the actual timing problem.Specifically, I would appreciate advice on how to:Inspect the audio and video packet timestamps, including PTS and DTS.Examine the actual video frame timestamps and determine whether they are consistent with a 25 FPS stream.Compare the audio packet timestamps and audio sample timing against the video timeline.Determine why FFprobe reports a video duration of 1352.04 seconds while the audio and container durations are approximately 1440.81 seconds.Establish whether the discrepancy is caused by incorrect timestamps, an unusual stream time base, missing or duplicated timestamps, an encoding problem, or another issue.Identify a reliable way to repair the file without unnecessarily degrading its quality.I am using FFmpeg on Windows. My FFmpeg build is a recent full build from gyan.dev.I am happy to run additional FFprobe or FFmpeg diagnostic commands and share their output.The important point is that I want to identify the cause first, then apply a correction based on the measured timing data. Simply changing the audio or video speed based on the difference between their reported durations has not worked so far.Thanks in advance for any suggestions.