项目简介
一款视频字幕AI工具:ai-no-jimaku-gumi,自动将视频转换成字幕并翻译成多种语言从视频音频中提取语音自动生成字幕
支持包括但不限于英语、日语、中文等多语言翻译
目前主要支持SRT字幕格式输出
支持自定义参数
安装
要开始使用 AI no jimaku组,请按照以下步骤操作:
-
克隆存储库:
git clone https://github.com/Inokinoki/ai-no-jimaku-gumi.git
2. 导航到项目目录:
cd ai-no-jimaku-gumi
3. 用cargo构建:
cargo build
4. 下载whisper模型(您也可以下载其他模型参考:https://huggingface.co/ggerganov/whisper.cpp ):
wget https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin
在--input-video-path
之后使用您的视频路径运行它,在-t
之后使用目标语言运行它。
用法
要使用AI no jimaku组,请参阅此帮助:
aI NO jimaKu gumI, a sub-title maker using AI.
Usage: ainojimakugumi [OPTIONS] --input-video-path <INPUT_VIDEO_PATH>
Options:
-i, --input-video-path <INPUT_VIDEO_PATH>
Name of the person to greet
--source-language <SOURCE_LANGUAGE>
Which language to translate from (default: "ja") (possible values: "en", "es", "fr", "de", "it", "ja", "ko", "pt", "ru", "zh") (example: "ja") [default: ja]
--target-language <TARGET_LANGUAGE>
Which language to translate to (default: "en") (possible values: "en", "es", "fr", "de", "it", "ja", "ko", "pt", "ru", "zh") (example: "en") [default: en]
--start-time <START_TIME>
Video start time [default: 0]
--end-time <END_TIME>
Video end time [default: 0]
--subtitle-source <SUBTITLE_SOURCE>
Subtitle source (default: "audio") (possible values: "audio", "container", "ocr") (example: "audio") (long_about: "Subtitle source to use") [default: audio]
--ggml-model-path <GGML_MODEL_PATH>
ggml model path (default: "ggml-tiny.bin") (example: "ggml-tiny.bin", ggml-small.bin") (long_about: "Path to the ggml model") [default: ggml-tiny.bin]
--only-extract-audio
Only extract the audio (default: false) (long_about: "Only extract the audio, if subtitle source is audio, but do not transcribe (Debug purpose)") (example: true)
--only-transcript
Only save the transcripted subtitle (default: false) (long_about: "Only save the transcripted subtitle but do not translate (Debug purpose)") (example: true)
--original-subtitle-path <ORIGINAL_SUBTITLE_PATH>
Original subtitle SRT file path (default: "") (example: "origin.srt") (long_about: "Original subtitle path to save the transcripted subtitle as SRT") [default: ]
--only-translate
Only translate the subtitle (default: false) (long_about: "Only translate the subtitle but do not export (Debug purpose)")
-s, --subtitle-backend <SUBTITLE_BACKEND>
Subtitle backend (default: "srt") (possible values: "srt", "container", "embedded") (example: "srt") (long_about: "Subtitle backend to use") [default: srt]
--subtitle-output-path <SUBTITLE_OUTPUT_PATH>
Subtitle output path (if srt) (default: "output.srt") (example: "output.srt") (long_about: "Subtitle output path (if srt)") [default: output.srt]
-t, --translator-backend <TRANSLATOR_BACKEND>
Translator backend (default: "deepl") (possible values: "deepl", "google", "llm") (example: "google") (long_about: "Translator backend to use") [default: deepl]
--llm-model-name <LLM_MODEL_NAME>
Model name (if llm) (default: "gpt-4o") (example: "gpt-4o") (long_about: "Model name (if using llm for translation)") [default: gpt-4o]
--llm-api-base <LLM_API_BASE>
API base (if llm) (default: "https://api.openai.com") (example: "https://api.openai.com") (long_about: "API base used in `genai` crate (if using llm for translation)") [default: https://api.openai.com]
--llm-prompt <LLM_PROMPT>
Prompt (if llm) (default: "") (example: "Translate the following text to English") (long_about: "Prompt (if using llm for translation)") [default: ]
-h, --help
Print help
-V, --version
Print version
我们目前仅支持deepl,
翻译和llm
srt
导出。
翻译后端
您可能需要按照特定说明来使用翻译器后端:
-
deepl
(默认):请在DEEPL_API_KEY
env 中提供您自己的 DeepL API 密钥,并且DEEPL_API_URL=https://api.deepl.com
如果您使用的是付费 API 版本。 -
:如果您使用llm翻译,请参阅 repo rust-genai了解更多详细信息。这里有一个例子:llm
export CUSTOM_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxx
./target/debug/ainojimakugumi --input-video-path one.webm \
--translator-backend llm \
--llm-api-base https://sssss.com/v1/ \
--llm-prompt 'translate this to English' \
--llm-model-name 'gpt-4o-mini'
--ggml-model-path ggml-small.bin
项目链接
https://github.com/Inokinoki/ai-no-jimaku-gumi
扫码加入技术交流群,备注「开发语言-城市-昵称」
(文:GitHubStore)