Skip to content

When a non-english dub exists of an anime, it can still be transcribed with the English model.  #5

@jinocenc

Description

@jinocenc

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

python-ffmpeg = "*"

suggested actions:

  • migrate to working(?) library
  • properly probe file for English audio streams using language meta-data
  • make sure exception is properly thrown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions