Skip to content

Commit

Permalink
Turn on Audio Sync for audio extraction process
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator Administrator committed Sep 2, 2024
1 parent 97ea3a8 commit 5ee7cde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_libs/subliminal_patch/providers/whisperai.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def encode_audio_stream(path, ffmpeg_path, audio_stream_language=None):
logger.debug(f"Whisper will only use the {audio_stream_language} audio stream for {path}")
inp = inp[f'a:m:language:{audio_stream_language}']

out, _ = inp.output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=16000) \
out, _ = inp.output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=16000, af="aresample=async=1") \
.run(cmd=[ffmpeg_path, "-nostdin"], capture_stdout=True, capture_stderr=True)

except ffmpeg.Error as e:
Expand Down
2 changes: 2 additions & 0 deletions libs/ffsubsync/speech_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ def fit(self, fname: str, *_) -> "VideoSpeechTransformer":
"1",
"-acodec",
"pcm_s16le",
"-af",
"aresample=async=1",
"-ar",
str(self.frame_rate),
"-",
Expand Down

0 comments on commit 5ee7cde

Please sign in to comment.