跳到正文
Skillpedia
视频剪辑18k · #10654

clip-hand-skill

它能做什么

这个技能提供制作短视频片段的专业步骤,包括使用 yt-dlp 下载、使用 Whisper 转录、编写 SRT 字幕,以及用 ffmpeg 剪辑。除了 shell 语法之外,这些工具在 Windows、macOS 和 Linux 上的选项相同。

适用场景

  • ✓当你想从一段较长的在线视频中剪出短片段时。
  • ✓当你需要根据视频中的语音生成字幕时。
  • ✓当你想在自己的电脑上用 ffmpeg 处理视频文件时。

技能链接

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-hands/bundled/clip/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-hands/bundled/clip/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请转录这段访谈视频,并制作三个带字幕的短片段。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能指导你下载源视频、转录其音频、生成字幕文件,并用 ffmpeg 裁剪片段。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Video Clipping Expert Knowledge

Cross-Platform Notes

All tools (ffmpeg, ffprobe, yt-dlp, whisper) use identical CLI flags on Windows, macOS, and Linux. The differences are only in shell syntax:

Feature macOS / Linux Windows (cmd.exe)
Suppress stderr 2>/dev/null 2>NUL
Filter output | grep pattern | findstr pattern
Delete files rm file1 file2 del file1 file2
Null output device -f null - -f null - (same)
ffmpeg subtitle paths subtitles=clip.srt subtitles=clip.srt (relative OK, absolute needs C\\:/path)

IMPORTANT: ffmpeg filter paths (-vf "subtitles=...") always need forward slashes. On Windows with absolute paths, escape the colon: subtitles=C\\:/Users/me/clip.srt

Prefer using file_write tool for creating SRT/text files instead of shell echo/heredoc.


yt-dlp Reference

Download with Format Selection

# Best video up to 1080p + best audio, merged
yt-dlp -f "bv[height<=1080]+ba/b[height<=1080]" --restrict-filenames -o "source.%(ext)s" "URL"

# 720p max (smaller, faster)
yt-dlp -f "bv[height<=720]+ba/b[height<=720]" --restrict-filenames -o "source.%(ext)s" "URL"

# Audio only (for transcription-only workflows)
yt-dlp -x --audio-format wav --restrict-filenames -o "audio.%(ext)s" "URL"

Metadata Inspection

# Get full metadata as JSON (duration, title, chapters, available subs)
yt-dlp --dump-json "URL"

# Key fields: duration, title, description, chapters, subtitles, automatic_captions

YouTube Auto-Subtitles

# Download auto-generated subtitles in json3 format (word-level timing)
yt-dlp --write-auto-subs --sub-lang en --sub-format json3 --skip-download --restrict-filenames -o "source" "URL"

# Download manual subtitles if available
yt-dlp --write-subs --sub-lang en --sub-format srt --skip-download --restrict-filenames -o "source" "URL"

# List available subtitle languages
yt-dlp --list-subs "URL"

Useful Flags

  • --restrict-filenames — safe ASCII filenames (no spaces/special chars) — important on all platforms
  • --no-playlist — download single video even if URL is in a playlist
  • -o "template.%(ext)s" — output template (%(ext)s auto-detects format)
  • --cookies-from-browser chrome — use browser cookies for age-restricted content
  • --extract-audio / -x — extract audio only
  • --audio-format wav — convert audio to wav (for whisper)

Whisper Transcription Reference

Audio Extraction for Whisper

# Extract mono 16kHz WAV (whisper's preferred input format)
ffmpeg -i source.mp4 -vn -ar 16000 -ac 1 -y audio.wav

Basic Transcription

# Standard transcription with word-level timestamps
whisper audio.wav --model small --output_format json --word_timestamps true --language en

# Faster alternative (same flags, 4x speed)
whisper-ctranslate2 audio.wav --model small --output_format json --word_timestamps true --language en

Model Sizes

Model VRAM Speed Quality Use When
tiny ~1GB Fastest Rough Quick previews, testing pipeline
base ~1GB Fast OK Short clips, clear speech
small ~2GB Good Good Default — best balance
medium ~5GB Slow Better Important content, accented speech
large-v3 ~10GB Slowest Best Final production, multiple languages

Note: On macOS Apple Silicon, consider mlx-whisper as a faster native alternative.

JSON Output Structure

{
  "text": "full transcript text...",
  "segments": [
    {
      "id": 0,
      "start": 0.0,
      "end": 4.52,
      "text": " Hello everyone, welcome back.",
      "words": [
        {"word": " Hello", "start": 0.0, "end": 0.32, "probability": 0.95},
        {"word": " everyone,", "start": 0.32, "end": 0.78, "probability": 0.91},
        {"word": " welcome", "start": 0.78, "end": 1.14, "probability": 0.98},
        {"word": " back.", "start": 1.14, "end": 1.52, "probability": 0.97}
      ]
    }
  ]
}
  • segments[].words[] gives word-level timing when --word_timestamps true
  • probability indicates confidence (< 0.5 = likely wrong)

YouTube json3 Subtitle Parsing

Format Structure

{
  "events": [
    {
      "tStartMs": 1230,
      "dDurationMs": 5000,
      "segs": [
        {"utf8": "hello ", "tOffsetMs": 0},
        {"utf8": "world ", "tOffsetMs": 200},
        {"utf8": "how ", "tOffsetMs": 450},
        {"utf
常见问题

它使用哪些工具?

它使用 yt-dlp 下载,使用 Whisper 转录语音,并使用 ffmpeg 剪辑片段和添加字幕。

它能在 Windows 上使用吗?

可以。该技能说明这些工具在 Windows、macOS 和 Linux 上使用相同的选项,只有 shell 语法略有不同。

字幕文件的路径容易出问题吗?

容易。ffmpeg 的字幕路径需要使用正斜杠,而 Windows 的绝对路径需要对冒号进行转义。

详情

作者的原始描述

Expert knowledge for AI video clipping — yt-dlp downloading, whisper transcription, SRT generation, and ffmpeg processing

repo: RightNow-AI/openfang

热度

GitHub 星标
18k
排名
#10654
许可证
Apache-2.0
更新时间
2026/7/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能