最近由于需要看一些英文的视频学习材料,其中不乏一些印度同仁的作品,口音着实不是很友好,有时候在github上找到了个挺好的项目,自动字幕。
使用 Autosub
用发很简单,记在这里主要为了防止遗忘!
使用Google Speech V2
1 | autosub -i <video.mp4> -S en-us |
这是默认的方法,不需要加额外的参数。
1 | Translation destination language not provided. Only performing speech recognition. |
大概原理就是使用FFmpeg把视频的音轨分离出来,然后调用Google API进行语音识别,最终生成字幕文件 TEST.en-us.srt
使用Google Cloud Speech-to-Text
1 | autosub -i <video.mp4> -S en-us -hsp https://<https_proxy>:<port> -hp http://<http_proxy>:<port> -sapi gcsv1 -skey xxxxxxx |
这种方式需要Google App Key,并且是时长付费的,尽管每月有免费的时间。具体操作看到项目ReadMe,并不是很麻烦。
安装Autosub
安装方法参考Readme就好,是一个Python脚本,使用pip安装一下就好了。
1 | apt install ffmpeg python3 curl git -y |
参考
https://github.com/BingLingGroup/autosub
最后顺便推荐几个YouTube视频以及字幕相关的网站
字幕在线编辑 https://www.nikse.dk/SubtitleEdit/Online
强烈推荐的Youtube字幕下载,可以直接下载原文和翻译 https://downsub.com/
另一个Youtube字幕下载 https://savesubs.com/
Youtube 视频下载 https://y2mate.is/en8/
Youtube 视频下载,支持多格式 https://btclod.com/