Example: If there is only a Japanese audio file then the Japanese audio file is transcribed as English and saved to the eSRT file.
The issue could be solved by checking for multiple streams and by checking for English streams.
This code block expects an error thrown from FFMPEG
|
try: |
|
output_file = f'{tmpdir}/{file}.wav' |
|
transcribe_audio_file(file, output_file) |
|
result = whisper.transcribe( |
|
model, output_file, beam_size=5, best_of=5, verbose=logger.getEffectiveLevel() <= logging.DEBUG, |
|
language="en") |
|
except ffmpeg.Error as e: |
|
logger.error(f'No English audio track found in {file}, error: {e.stderr}') |
|
raise ValueError(f'No English audio track found in {file}') |
The error should be thrown here
|
def transcribe_audio_file(input_file, output_file): |
|
( |
|
ffmpeg |
|
.input(input_file) |
|
.audio(metadata='language=eng') |
|
.output(output_file, output_format='mp3') |
|
.overwrite_output() |
|
.run() |
|
) |
--Except, I'm pretty sure this library doesn't support English-stream identification
suggested actions:
Example: If there is only a Japanese audio file then the Japanese audio file is transcribed as English and saved to the eSRT file.
The issue could be solved by checking for multiple streams and by checking for English streams.
This code block expects an error thrown from FFMPEG
whisper_grpc/whisper_grpc/transcribe.py
Lines 20 to 28 in e5a1690
The error should be thrown here
whisper_grpc/whisper_grpc/transcribe.py
Lines 35 to 43 in e5a1690
--Except, I'm pretty sure this library doesn't support English-stream identification
whisper_grpc/Pipfile
Line 11 in e5a1690
suggested actions: