Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn on Audio Sync for audio extraction process #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dvh312
Copy link

@dvh312 dvh312 commented Sep 18, 2024

Please see the original MR here morpheus65535/bazarr#2648

Problem description

  • I used Whisper AI and recognized that the subtitles generated didn't have the correct timestamps, especially near the end of the video.

Cause

  1. The video files I'm using have some corrupted frames.
  2. ffmpeg try to "skip" these frames, causing the duration of the extracted audio to be significantly shorter than the original video duration.

Solution

  • Turning on audio sync to make the extracted audio matches the video timestamps.

Screenshots

Original command

ffmpeg  -i input.mp4  -acodec pcm_s16le -ac 1 -ar 16000 -f s16le output.wav 

ffmpeg-before.log

Imported to Audacity, only shows the duration of 22m52s532ms. The video duration is 22m59s960ms. This means subtitles will be shifted by almost 7 seconds ahead.

Screenshot 2024-09-01 at 5 23 34 PM Screenshot 2024-09-01 at 5 24 23 PM

Updated command

ffmpeg  -i input.mp4  -acodec pcm_s16le -ac 1 -ar 16000 -f s16le -af aresample=async=1 output.wav 

ffmpeg-after.log

Audacity now shows the duration of 22m59s349ms, which is approximately the original video duration of 22m59s960ms

Screenshot 2024-09-01 at 5 28 37 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant