garroshub/MixCut-Skill / skills
youtube-clipper
VerifiedYouTube 视频智能剪辑工具。下载视频和字幕,AI 分析生成精细章节(几分钟级别), 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频,并生成总结文案。 使用场景:当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词:视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video
| File | Kind | Size |
|---|---|---|
| .env.example | other | 2.8 KB |
| .github/REPOSITORY_SETTINGS.md | markdown | 1.4 KB |
| .gitignore | other | 372 B |
| FIXES_AND_IMPROVEMENTS.md | markdown | 8.0 KB |
| LICENSE | other | 1.0 KB |
| README.md | markdown | 8.4 KB |
| README.zh-CN.md | markdown | 7.8 KB |
| SKILL.md | skill md | 10.6 KB |
| TECHNICAL_NOTES.md | markdown | 11.3 KB |
| install_as_skill.sh | script | 6.8 KB |
| references/ffmpeg-guide.md | markdown | 3.4 KB |
| references/subtitle-formatting.md | markdown | 7.7 KB |
| references/yt-dlp-guide.md | markdown | 6.3 KB |
| scripts/__init__.py | script | 128 B |
| scripts/analyze_subtitles.py | script | 8.2 KB |
| scripts/burn_subtitles.py | script | 8.5 KB |
| scripts/clip_video.py | script | 7.4 KB |
| scripts/download_video.py | script | 6.6 KB |
| scripts/extract_subtitle_clip.py | script | 3.6 KB |
| scripts/generate_summary.py | script | 6.1 KB |
| scripts/merge_bilingual_subtitles.py | script | 2.2 KB |
| scripts/translate_subtitles.py | script | 6.9 KB |
| scripts/utils.py | script | 8.0 KB |
scripts/merge_bilingual_subtitles.py
View on GitHub#!/usr/bin/env python3
"""
合并英文和中文字幕为双语 SRT 文件
"""
import sys
import re
def parse_srt_file(file_path):
"""解析 SRT 文件"""
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
# 分割字幕块
blocks = content.strip().split('\n\n')
subtitles = []
for block in blocks:
lines = block.strip().split('\n')
if len(lines) >= 3:
index = lines[0]
time = lines[1]
text = '\n'.join(lines[2:])
subtitles.append({
'index': index,
'time': time,
'text': text
})
return subtitles
def merge_bilingual_subtitles(english_file, chinese_file, output_file):
"""合并英文和中文字幕"""
print(f"📝 合并双语字幕...")
print(f" 英文字幕: {english_file}")
print(f" 中文字幕: {chinese_file}")
# 解析两个字幕文件
english_subs = parse_srt_file(english_file)
chinese_subs = parse_srt_file(chinese_file)
if len(english_subs) != len(chinese_subs):
print(f"⚠️ 警告: 英文字幕 ({len(english_subs)} 条) 和中文字幕 ({len(chinese_subs)} 条) 数量不匹配")
# 合并字幕
bilingual_subs = []
for i in range(min(len(english_subs), len(chinese_subs))):
bilingual_subs.append({
'index': english_subs[i]['index'],
'time': english_subs[i]['time'],
'text': f"{english_subs[i]['text']}\n{chinese_subs[i]['text']}"
})
# 写入双语字幕文件
with open(output_file, 'w', encoding='utf-8') as f:
for sub in bilingual_subs:
f.write(f"{sub['index']}\n")
f.write(f"{sub['time']}\n")
f.write(f"{sub['text']}\n")
f.write("\n")
print(f"✅ 双语字幕生成完成")
print(f" 输出文件: {output_file}")
print(f" 字幕条数: {len(bilingual_subs)}")
if __name__ == '__main__':
if len(sys.argv) != 4:
print("用法: python merge_bilingual_subtitles.py <english_srt> <chinese_srt> <output_srt>")
sys.exit(1)
english_file = sys.argv[1]
chinese_file = sys.argv[2]
output_file = sys.argv[3]
merge_bilingual_subtitles(english_file, chinese_file, output_file)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |