«

auto-subtitle利用open AI Whisper离线自生成字幕

学长 发布于 阅读:319 软件


autosub太老需要上传谷歌需要 python2.7
auto-subs是给达芬奇剪辑软件用的

https://github.com/m1guelpf/auto-subtitle
使用离线的 OpenAI's Whisper
ffmpeg,同时需要去 https://github.com/BtbN/FFmpeg-Builds/releases
下载合适的 windows版本(我选择的是 ffmpeg-n7.1-latest-win64-lgpl-shared-7.1.zip)解压到合适的位置并且在环境变量的 Path中添加这个目录
我是通过 conda安装的
同时也得把 pythonscript添加到环境变量,在用户的变量里添加

%temp%\..\..\roaming\python\python312\scripts\

还有 conda的安装目录,因为python的执行文件在那里

pip install ffmpeg-python

pip要卸载 ffmpeg,因为跟 windows的指令不对应。。。在 pip中安装的只是 ffmpeg的指令不是执行文件。。。

pip uninstall ffmpeg

使用办法:

auto_subtitle '1.mp4' --srt_only  'True'

使用默认的指令

auto_subtitle '1.mp4' -o subtitled/

报错,估计是 ffmpeg合成加字幕的视频的时候指令出问题,
查看到时读不到字幕地址,也许因为 windows的地址问题。。。
实际上也不需要合成字幕和视频。。。

另外就是 wav是在 %temp%应该不是自动清除。。。

windows下的拖拽文件:

@echo off
chcp 65001>>nul
set as="%temp%\..\..\roaming\python\python312\scripts\auto_subtitle.exe"
%as% "%~nx1" --srt_only  "True"
del /f %temp%\%~n1.wav
::pause

保存成 .bat
拖拽到上面就能生成字幕了
或者来看看这个
https://github.com/leejohannes/ffmpeg-win-drag_CN

推荐阅读:


扫描二维码,在手机上阅读