video-translation by noizai/skills
npx skills add https://github.com/noizai/skills --skill video-translation将视频中的语音翻译成另一种语言,使用 TTS 生成配音音频并替换原始音轨。
当用户请求翻译视频时:
下载视频和字幕:使用 youtube-downloader 技能下载视频及其 SRT 格式的字幕。确保指定源语言以获取正确的字幕。
python path/to/youtube-downloader/scripts/download_video.py "VIDEO_URL" --subtitles --sub-lang <source_lang_code> -o /tmp/video-translation
翻译字幕:读取下载的 .srt 文件。使用以下固定提示词,将其内容逐句翻译成目标语言。保持完全相同的 SRT 索引和时间戳格式!
翻译提示词:
Translate the following subtitle text from to . Provide ONLY the translated text. Do not explain, do not add notes, do not add index numbers. The translation must be colloquial, natural-sounding, and suitable for video dubbing.
将翻译后的文本保存到新文件 translated.srt。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
tts 技能根据翻译后的 SRT 文件渲染时间轴精确的音频。Noiz 后端会自动将每个句子的时长与原视频字幕时间戳对齐。为确保克隆的语音与原始说话者在每个句子中的确切语调和情感相匹配,请将原始视频文件传递给 --ref-audio-track。TTS 引擎将自动在每个字幕的精确时间戳处切片原始音频,并将其用作该特定片段的参考。
创建一个基本的 voice_map.json:
{
"default": {
"target_lang": "<target_lang_code>"
}
}
渲染时间轴精确的音频:
bash skills/tts/scripts/tts.sh render --srt translated.srt --voice-map voice_map.json --backend noiz --auto-emotion --ref-audio-track original_video.mp4 -o dubbed.wav
4. 替换视频中的音频:使用 replace_audio.sh 脚本将原始视频与新的配音音频合并。为了保留原始视频在翻译片段之外的非语音背景音,请传递 --srt 文件。
bash skills/video-translation/scripts/replace_audio.sh --video original_video.mp4 --audio dubbed.wav --output final_video.mp4 --srt translated.srt
5. 呈现结果:将 final_video.mp4 文件路径返回给用户。
VIDEO_URL:要翻译的视频的 URL。target_language:要将音频翻译成的语言。source_language:原始视频的语言(如果未自动检测或指定)。reference_audio:用于语音克隆的特定音频文件/URL,而不是动态的原始视频音轨。skills/youtube-downloader 目录到你的 skills/ 文件夹,确保 skills/youtube-downloader/scripts/download_video.py 可用。skills/tts 目录到你的 skills/ 文件夹。确保 skills/tts/scripts/tts.sh 及相关脚本存在。NOIZ_API_KEY。如果未设置,首先引导用户从 https://developers.noiz.ai/api-keys 获取 API 密钥。用户提供密钥后,询问他们是否希望持久保存;如果他们同意,可以在项目的 .env 文件中写入/更新 NOIZ_API_KEY=...,或者运行 bash skills/tts/scripts/tts.sh config --set-api-key YOUR_KEY 来存储它。ffmpeg。每周安装数
1.3K
代码仓库
GitHub 星标数
402
首次出现
2026年3月2日
安全审计
安装于
opencode1.3K
gemini-cli1.3K
kimi-cli1.3K
cline1.3K
cursor1.3K
github-copilot1.3K
Translate a video's speech into another language, using TTS to generate the dubbed audio and replacing the original audio track.
When the user asks to translate a video:
Download Video & Subtitles: Use the youtube-downloader skill to download the video and its subtitles as SRT. Make sure you specify the source language to fetch the correct subtitle.
python path/to/youtube-downloader/scripts/download_video.py "VIDEO_URL" --subtitles --sub-lang <source_lang_code> -o /tmp/video-translation
Translate Subtitles : Read the downloaded .srt file. Translate its contents sentence by sentence into the target language using the following fixed prompt. Keep the exact same SRT index and timestamp format!
Translation Prompt :
Translate the following subtitle text from to . Provide ONLY the translated text. Do not explain, do not add notes, do not add index numbers. The translation must be colloquial, natural-sounding, and suitable for video dubbing.
Save the translated text into a new file translated.srt.
tts skill to render the timeline-accurate audio from the translated SRT. The Noiz backend automatically aligns the duration of each sentence to the original video's subtitle timestamps.To ensure the cloned voice matches the original speaker's exact tone and emotion for each sentence, pass the original video file to --ref-audio-track. The TTS engine will automatically slice the original audio at each subtitle's exact timestamp and use it as the reference for that specific segment.
Create a basic voice_map.json:
{
"default": {
"target_lang": "<target_lang_code>"
}
}
Render the timeline-accurate audio:
bash skills/tts/scripts/tts.sh render --srt translated.srt --voice-map voice_map.json --backend noiz --auto-emotion --ref-audio-track original_video.mp4 -o dubbed.wav
4. Replace Audio in Video : Use the replace_audio.sh script to merge the original video with the new dubbed audio. To keep the original video's non-speech audio background outside of translated segments, pass the --srt file.
bash skills/video-translation/scripts/replace_audio.sh --video original_video.mp4 --audio dubbed.wav --output final_video.mp4 --srt translated.srt
5. Present the Result : Return the final_video.mp4 file path to the user.
VIDEO_URL: The URL of the video to translate.target_language: The language to translate the audio to.source_language: The language of the original video (if not auto-detected or specified).reference_audio: Specific audio file/URL to use for voice cloning instead of the dynamic original video track.skills/youtube-downloader directory from crazynomad/skills into your skills/ folder so that skills/youtube-downloader/scripts/download_video.py is available.skills/tts directory from NoizAI/skills into your skills/ folder. Ensure skills/tts/scripts/tts.sh and related scripts are present.Weekly Installs
1.3K
Repository
GitHub Stars
402
First Seen
Mar 2, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
opencode1.3K
gemini-cli1.3K
kimi-cli1.3K
cline1.3K
cursor1.3K
github-copilot1.3K
30,400 周安装
NOIZ_API_KEY configured for the Noiz backend. If it is not set, first guide the user to get an API key from https://developers.noiz.ai/api-keys. After the user provides the key, ask whether they want to persist it; if they agree, either write/update NOIZ_API_KEY=... in the project's .env file or run bash skills/tts/scripts/tts.sh config --set-api-key YOUR_KEY to store it.ffmpeg installed.