Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

yt2bb

БесплатноЗапускает вложенные скриптыНе проверен

Use when the user wants to repurpose a YouTube video for Bilibili, add bilingual (English-Chinese) subtitles to a video, or create hardcoded subtitle versions…

Agents365-aiот Agents365-ai★ 108 звёзд на GitHub

Об этом скилле

yt2bb — YouTube to Bilibili Video Repurposing

Overview

Six-step pipeline: download → transcribe → translate → merge → burn subtitles → generate publish info. Produces a video with hardcoded bilingual (EN/ZH) subtitles and a publish_info.md with Bilibili upload metadata.

When to Use

  • User provides a YouTube URL (single video or playlist) and wants a Bilibili-ready version
  • User needs bilingual EN-ZH subtitles burned into video
  • User wants to repurpose English video content for Chinese audience

Quick Reference

Step Tool Command Output
0. Update git Auto-check for skill updates —
1. Download yt-dlp yt-dlp --cookies-from-browser chrome -f ... -o ... {slug}.mp4
2. Transcribe whisper* srt_utils.py check-whisper then transcribe {slug}_{lang}.srt
2.5 Validate srt_utils.py srt_utils.py validate / fix {slug}_{lang}.srt (fixed)
3. Translate AI SRT-aware batch translation {slug}_zh.srt
4. Merge srt_utils.py srt_utils.py merge ... {slug}_bilingual.srt
4.5 Style srt_utils.py srt_utils.py to_ass --preset netflix|clean|glow {slug}_bilingual.ass
5. Burn ffmpeg ffmpeg -c:v libx264 -vf ass=... {slug}_bilingual.mp4
6. Publish AI Analyze content, generate metadata publish_info.md

Resolve the skill directory

Resolve SKILL_DIR for use by later pipeline steps:

# Find the skill dir: a 'yt2bb' folder that actually contains SKILL.md.
# Works whether installed flat (~/.claude/skills/yt2bb) or pulled from this repo (skills/yt2bb).
SKILL_DIR="$(find ~/.claude/skills ~/.openclaw/skills ~/.hermes/skills ~/.pi/agent/skills ~/.agents/skills ~/myagents/myskills -type d -name 'yt2bb' -exec test -f '{}/SKILL.md' \; -print 2>/dev/null | head -1)"

Pipeline Details

Step 1: Download

Single video:

slug="video-name"  # or: slug=$(python3 "$SKILL_DIR/srt_utils.py" slugify "Video Title")
mkdir -p "${slug}"
yt-dlp --cookies-from-browser chrome \
  -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4]" \
  -o "${slug}/${slug}.mp4" "https://www.youtube.com/watch?v=VIDEO_ID"

Playlist / series:

yt-dlp --cookies-from-browser chrome \
  -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4]" \
  -o "%(playlist_index)03d-%(title)s/%(playlist_index)03d-%(title)s.mp4" \
  "https://www.youtube.com/playlist?list=PLAYLIST_ID"

After downloading, rename each folder to a clean slug and run Steps 2–6 for each video sequentially.

  • -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4]": ensure mp4 output, avoid webm
  • %(playlist_index)03d: zero-padded index to preserve playlist order
  • If --cookies-from-browser fails, export cookies first — see Troubleshooting

Step 2: Transcribe

First run the environment check to detect your platform and get a tailored whisper command:

python3 "$SKILL_DIR/srt_utils.py" check-whisper

This auto-detects OS, GPU (CUDA/Metal/CPU), memory, and installed backends, then recommends the best backend + model for your hardware. If memory detection is unavailable, it falls back conservatively instead of assuming a low-memory machine. Use the command it prints.

Manual fallback (openai-whisper, works everywhere):

src_lang="en"      # Change to ja/ko/es/etc. based on source video
whisper_model="medium"  # check-whisper recommends the best model for your hardware
whisper "${slug}/${slug}.mp4" \
  --model "$whisper_model" \
  --language "$src_lang" \
  --word_timestamps True \
  --condition_on_previous_text False \
  --output_format srt \
  --max_line_width 40 --max_line_count 1 \
  --output_dir "${slug}"
mv "${slug}/${slug}.srt" "${slug}/${slug}_${src_lang}.srt"

Supported backends:

Backend Best for Install
mlx-whisper macOS Apple Silicon (fastest) pip install mlx-whisper
whisper-ctranslate2 Windows/Linux CUDA, or CPU (~4x faster) pip install whisper-ctranslate2
openai-whisper Universal fallback pip install openai-whisper

Model selection (auto-recommended by check-whisper):

  • tiny — fast draft, low accuracy, CPU-friendly (~1 GB)
  • medium — default, good balance (~5 GB)
  • large-v3 — best accuracy, recommended for JA/KO/ZH source (~10 GB)

Notes:

  • --language: explicitly set to avoid misdetection; supports en, ja, ko, es, etc.
  • --word_timestamps True: more precise subtitle timing
  • --condition_on_previous_text False: prevent hallucination loops
  • If output is garbled or repeated, add anti-hallucination flags — see Troubleshooting

Step 2.5: Validate & Fix (optional)

python3 "$SKILL_DIR/srt_utils.py" validate "${slug}/${slug}_${src_lang}.srt"
# If issues found:
python3 "$SKILL_DIR/srt_utils.py" fix "${slug}/${slug}_${src_lang}.srt" "${slug}/${slug}_${src_lang}.srt"

Step 3: Translate

Read {slug}_{src_lang}.srt and translate to Chine

Полный SKILL.md на GitHub

Установить yt2bb в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(python3:*)
Bash(ffmpeg:*)
Bash(whisper:*)
Bash(yt-dlp:*)
Bash(git:*)
Read
Write
Edit

Вложенные файлы

srt_utils.py

FAQ

Что делает скилл yt2bb?

Use when the user wants to repurpose a YouTube video for Bilibili, add bilingual (English-Chinese) subtitles to a video, or create hardcoded subtitle versions for Chinese platforms.

Как установить скилл yt2bb?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл yt2bb запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить yt2bb с