下载
https://github.com/agermanidis/autosub
它是基于Google Web Speech API实现的,需要翻墙请求外部接口
通过python安装项目,会下载对应的autosub到环境变量
pip install git+https://github.com/agermanidis/autosub.git
输入以下命令有返回则代表安装成功:
autosub -h
让本地http请求走代理端口(这里演示我本地的mac环境,其他环境差不多,要启动一个翻墙服务,一般都是暴露1090端口)
vim ~/.zshrc
alias setproxy="export ALL_PROXY=http://127.0.0.1:1090"
alias unsetproxy="unset ALL_PROXY"
让环境变量生效
souce ~/.zshrc
setproxy
最后执行转字幕命令
autosub -S zh-CN -D zh-CN test.mp4 (之前发现卡住了,parse过程很慢,后面联想到请求googel接口问题,需要翻墙)
最后执行成功了,生成的效果还可以