本文へ移動
cccskills
無料GitHub で公開

daftai-video-subtitler

Burn subtitles into local video files. Supports SRT/VTT/ASS formats, auto-detect subtitles and language, bilingual subtitle merging and translation. Use when user needs to hardcode subtitles into video. Keywords: 字幕烧录、burn subtitles、本地视频、hardcode subtitles

インストール方法を見る

含まれるファイル(8)

  • SKILL.md10.0 KB
  • references/config/first-time-setup.md5.1 KB
  • references/config/preferences-schema.md8.9 KB
  • scripts/burn_subtitles.ts12.9 KB
  • scripts/convert_vtt_to_srt.ts2.5 KB
  • scripts/detect_language.ts3.3 KB
  • scripts/merge_bilingual_subtitles.ts2.8 KB
  • scripts/utils.ts4.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Video Subtitle Burner

Burn (hardcode) subtitle files into local video.

Scripts: All scripts are in scripts/ relative to this SKILL.md. CRITICAL: When running any bun scripts/... command, you MUST set the working directory (cwd) to this skill's base directory. Do NOT run from the user's project directory.

Priority Chain

User explicit input > Project EXTEND.md > User EXTEND.md > Built-in defaults

Workflow

- [ ] Step 0: Load preferences (EXTEND.md) ⛔ BLOCKING
- [ ] Step 1: Environment check (FFmpeg + libass + fonts)
- [ ] Step 2: Input files (video + subtitle + language detection)
- [ ] Step 3: Confirm mode (mono/bilingual/translate) ⚠️ skip if quick_mode=true
- [ ] Step 4: Preprocess (timeline fix, format convert, merge, translate)
- [ ] Step 5: Burn subtitles + watermark/source label
- [ ] Step 6: Output report

Flow

Input → [Step 0: Preferences] ─┬─ Found → Load summary → Continue
                                └─ Not found → First-time setup ⛔ → Save EXTEND.md → Continue
        ↓
[Step 1: Env Check] → FFmpeg + libass + fonts
        ↓
[Step 2: Input Files] → Video + subtitle scan + language detect + timeline offset check
        ↓
[Step 3: Confirm Mode] → Mono / Bilingual / Translate ⚠️ skippable
        ↓
[Step 4: Preprocess] ─┬─ Timeline fix (if offset)
                      ├─ VTT → SRT convert (if merge/translate)
                      ├─ Bilingual merge (if needed)
                      └─ Translate subtitle (if needed)
        ↓
[Step 5: Burn] ─┬─ Subtitle hardcode
                ├─ Watermark overlay (if enabled)
                └─ Source label overlay (if enabled)
        ↓
[Step 6: Output] → File path + size + preview command

Step 0: Load Preferences ⛔ BLOCKING

Check EXTEND.md (project-level first, then user-level):

test -f .daftAI-skills/daftAI-video-subtitler/EXTEND.md && echo "project"
test -f "$HOME/.daftAI-skills/daftAI-video-subtitler/EXTEND.md" && echo "user"
ResultAction
FoundRead, parse, display summary → Continue
Not found⛔ Run first-time-setup → Save → Continue

CRITICAL: Must complete setup before asking ANY other questions.


Step 1: Environment Check

Goal: Ensure FFmpeg and fonts are available

  1. Detect FFmpeg and libass:

    ffmpeg -version
    ffmpeg -filters 2>&1 | grep subtitles
    
  2. Detect font (by priority, respecting preferences):

    • Preferred font from EXTEND.md → use if available
    • Alibaba PuHuiTi 3.0 → use if available
    • Noto Sans CJK → use if available
    • Fallback → system default

If missing libass:

  • macOS: brew install ffmpeg
  • Ubuntu: sudo apt install ffmpeg libass-dev

Step 2: Input Files

Goal: Get video and subtitle files

  1. User provides video path (mp4, mkv, avi, etc.)

  2. Auto-scan subtitles in same directory:

    • Prefer same-name subtitle (video.mp4 → video.srt)
    • Single subtitle → use directly
    • Multiple subtitles → list for user to choose
  3. Supported formats: .srt, .vtt, .ass, .ssa

  4. Timeline offset detection (MUST execute):

    ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "<video_path>"
    

    If subtitle start time > video duration → offset detected, needs fix.

  5. VTT → SRT conversion only when merging or translating:

    bun scripts/convert_vtt_to_srt.ts "<vtt_path>" "<srt_output>"
    
  6. Auto-detect language:

    • From filename (subtitles_zh.srt → zh)
    • From content (Chinese characters → zh, Japanese kana → ja)

Step 3: Confirm Mode

Goal: Confirm mono/bilingual/translate + source label

Language: Use user's input language or preferred language for all questions. Do not always use English.

Use single AskUserQuestion with multiple questions when confirmation is needed.

⚠️ If quick_mode: true in preferences and intent is clear, skip subtitle confirmation. Source label still asked each time.

  1. Ask user (only when preferences insufficient):

    • Bilingual subtitles? (select second subtitle file)
    • Translation needed? (only when user explicitly requests)
  2. Source label (ask every time): If source_label.enabled: true in preferences:

    What's the source for this video? (will display as "素材来自于 XXX")


Step 4: Preprocess

Goal: Prepare final subtitle file

CRITICAL: Translated/merged subtitle artifacts MUST be kept by default for reuse. Detection-only process artifacts (screenshots/probe logs/temp checks) should be cleaned up by default unless debugging is requested.

4a: Translate (if needed)

Trigger: User explicitly requests translation.

Output path: <output_dir>/<video_name>_<target_lang>.srt (e.g., output/video_zh.srt)

Principles: Accuracy first, natural flow, concise.

  1. Accuracy: Preserve original meaning
  2. Fluency: Natural target language word order
  3. Conciseness: Conversational tone, no redundancy
  4. Consistency: Same term = same translation throughout
  5. Punctuation: No period (。) at end of subtitle lines for zh

Term mapping:

EnglishChinese
AI AgentAI 智能体
LLM大语言模型
SkillsSkills (keep English)
overfitting过拟合
Other termsUse industry-standard translation

Batch: Translate 20 lines per batch.

Count validation (MUST execute):

  • After translation: translated count MUST equal original count
  • If mismatch → fix it. NEVER say "only off by one, close enough"
  • Verify: grep -c "^[0-9]\+$" <original> vs grep -c "^[0-9]\+$" <translated>

4b: Bilingual Merge (if needed)

Output path: <output_dir>/<video_name>_bilingual.srt (e.g., output/video_bilingual.srt)

bun scripts/merge_bilingual_subtitles.ts \
  "<top_subtitle.srt>" \
  "<bottom_subtitle.srt>" \
  "<output_dir>/<video_name>_bilingual.srt"

Order: from preferences bilingual.order, fallback to default (Chinese top, English bottom).


Step 5: Burn Subtitles

Goal: Hardcode subtitles into video

bun scripts/burn_subtitles.ts \
  "<video_path>" \
  "<subtitle_path>" \
  "<output_path>" \
  [--font-size <数字>] \
  [--outline <数字>] \
  [--margin-v <数字>] \
  [--crf <数字>] \
  [--watermark-text <文字>] \
  [--watermark-position <top-left|top-right|bottom-left|bottom-right>] \
  [--watermark-opacity <0-1>] \
  [--source-text <文字>] \
  [--source-position <top-left|top-right|bottom-left|bottom-right>] \
  [--source-opacity <0-1>]

All -- options are optional and fall back to EXTEND.md preferences or built-in defaults.

Parameters (from preferences, fallback to defaults):

ParameterPreference fieldDefault
Codecencoding.codecH.264
Qualityencoding.crfCRF 18
FontfontAlibaba PuHuiTi 3.0
Font sizefont_size21
Outlineoutline0.75
Marginmargin_v15
Colorbuilt-inWhite text, black outline
Watermark textwatermark.textNone
Watermark positionwatermark.positiontop-right
Watermark opacitywatermark.opacity0.7
Source textsource_label.prefix + per-session素材来自于 {source}
Source positionsource_label.positiontop-left
Source opacitysource_label.opacity0.7

Step 6: Output Report

Goal: Show results

  1. Output directory: from preferences output.directory, fallback to ./output/

  2. Naming (from preferences output.naming, fallback to defaults):

    • Mono: video_zh.mp4
    • Bilingual: video_zh-en.mp4
  3. Intermediate files policy:

    • Keep generated translated subtitles (e.g., subtitle_zh.srt)
    • Keep generated bilingual merged subtitles (e.g., bilingual.srt)
    • Clean detection-only process artifacts by default (screenshots/probe logs/temp checks)
    • If debugging is required, set artifacts.keep_screenshots / artifacts.keep_probe_logs to true
  4. Show user:

    • Output file path
    • File size
    • Intermediate file paths (if any)
    • Preview: open "<output_path>"

Error Handling

IssueSolution
FFmpeg missing subtitles filterInstall FFmpeg with libass
Subtitle encoding errorConvert to UTF-8
Path contains spacesScripts auto-use temp directory
Font not foundAuto-fallback to next priority font

Examples

Mono subtitle:

User: Add Chinese subtitles to this video
→ Load prefs → Env check → Scan subtitles → Burn → output video_zh.mp4

Bilingual:

User: Add both Chinese and English subtitles
→ Load prefs → Merge bilingual → Burn → output video_zh-en.mp4

Translate + burn:

User: Translate English subtitles to Chinese then burn
→ Load prefs → Translate → Burn → output video_zh.mp4

With watermark:

User: Add Chinese subtitles with @daftAI watermark
→ Load prefs → Env check → Scan subtitles → Burn (with watermark) → output video_zh.mp4

Extension

Customize via EXTEND.md. See Step 0 for paths.

Supports: font | size | outline | margin | color | CRF | bilingual order | output dir | naming | language | watermark | source label | quick mode | artifacts policy

Schema: references/config/preferences-schema.md

References

FileContent
first-time-setup.mdFirst-time setup flow
preferences-schema.mdFull preferences schema

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Checks and fixes Chinese copywriting with autocorrect-backed workflows for text and single-file Markdown/TXT inputs. Use when user asks to normalize Chinese punctuation, spacing, full-width/half-width usage, or copywriting style. Also triggers for "校对", "检查排版", "中英文空格", "全角半角".

日本語の概要は準備中です。原文の説明を表示しています。

daftAI2026/daftAI-skills182026年9月10日 更新

Extracts timed subtitles from local video/audio files using Whisper. Outputs SRT format with accurate timestamps. Handles complex filenames automatically. Use when user asks to "extract subtitles", "get subtitles", "transcribe video", "识别字幕", "提取字幕", or "获取字幕".

日本語の概要は準備中です。原文の説明を表示しています。

daftAI2026/daftAI-skills182026年9月10日 更新

Optimizes natural-language image requests and rough prompts into ready-to-use GPT Image 2.5 prompts using the official prompting guide as a live reference. Use when users ask to improve image prompts, 优化生图提示词, 把想法变成提示词, or write prompts for GPT Image 2.5 Flare or Sunburst. Produces prompt text, not images, unless the user explicitly asks to generate.

日本語の概要は準備中です。原文の説明を表示しています。

daftAI2026/daftAI-skills182026年9月10日 更新

Converts transparent or solid-background single-color PNG files and SVG files containing one embedded or local PNG into verified path-only SVG output. Removes pure-color backgrounds automatically. Uses Potrace threshold and parameter scans with alpha error metrics to preserve detailed logos, stamps, engravings, and line art. Use when the user asks to convert images to SVG, vectorize PNG, convert bitmap to true SVG, remove embedded raster data from SVG, 图片转矢量, PNG 转 SVG, 真矢量, or 位图描摹.

日本語の概要は準備中です。原文の説明を表示しています。

daftAI2026/daftAI-skills182026年9月10日 更新

Translate subtitle files (SRT/VTT) between languages. Auto-detect source language, batch translate with count validation, optional bilingual merge output. Use when user asks to "translate subtitles", "翻译字幕", "subtitle translation", or needs subtitles converted to another language.

日本語の概要は準備中です。原文の説明を表示しています。

daftAI2026/daftAI-skills182026年9月10日 更新

Fetch any URL and convert to markdown using Chrome CDP, with automatic image downloading. Supports auto-capture and wait-for-user modes. Downloads article images to local directory and rewrites image references to relative paths. Use when user wants to save a webpage as markdown with images. Keywords: url to markdown, save webpage, download article, 网页转markdown

日本語の概要は準備中です。原文の説明を表示しています。

daftAI2026/daftAI-skills182026年9月10日 更新

daftAI2026 のスキルをすべて見る

このスキルの問題を報告する