mli / autocut

用文本编辑器剪视频
Apache License 2.0
6.6k stars 659 forks source link

英文文本会自动翻译 #115

Open FreedomXD opened 9 months ago

FreedomXD commented 9 months ago

我有一批英文录音,想自动输出字幕但结果不甚理想,主要是会出现自动翻译的问题。以下是一段六级英语听力的转录结果

exts generated from A3_wKgMbl2yw1yiIds-AGX_jo0hufs184.srt.Mark the sentences to keep for autocut. The format is [subtitle_index,duration_in_second] subtitle context.

原文都是英文,但转录出来的是中文。

请求参数:autucut -d .data/ --whisper-model=large

另外由于国内网络环境使用,我把transcribe.py中的62行以下的vad_model请求换成了使用本地文件 ‘’’ if self.vad_model is None or self.detect_speech is None:

torch load limit https://github.com/pytorch/vision/issues/4156

        torch.hub._validate_not_a_forked_repo = lambda a, b, c: True
        #self.vad_model, funcs = torch.hub.load(
        #    repo_or_dir="snakers4/silero-vad", model="silero_vad", trust_repo=True
        #)
        self.vad_model, funcs = torch.hub.load(
            repo_or_dir="/root/.cache/torch/hub/snakers4_silero-vad_master/", model="silero_vad", trust_repo=True, source='local'
        )
        self.detect_speech = funcs[0]

‘’‘

chenqianhe commented 9 months ago

https://github.com/mli/autocut/blob/638f6d8bab9ddfb07017267befd4c40208809dfc/autocut/main.py#L50

--lang 指定语言

FreedomXD commented 9 months ago

https://github.com/mli/autocut/blob/638f6d8bab9ddfb07017267befd4c40208809dfc/autocut/main.py#L50

--lang 指定语言

如果是中英文混合的音频,这里怎么指定好呢?我想让它中文的返回中文,英文的返回英文,谢谢!

chenqianhe commented 9 months ago

指定中文然后纯靠模型表现或者也许只能提前划分音频?如果指定语言为英文模型会把所有内容翻译为英文。