Communitygithub.com

ComeOnOliver/skillshub

使用 OpenAI Whisper 和 yt-dlp 将 YouTube 视频转录为文本。

skillshub 是什么?

该技能结合了 yt-dlp 下载 YouTube 视频音频和 OpenAI Whisper 模型进行高精度语音转文本转录。支持多种输出格式(TXT、SRT、VTT、JSON)和不同大小的模型(tiny、base、small、medium、large),可根据速度和准确度的需求灵活选择。工作流程简单:先通过 yt-dlp 提取音频(WAV 或 MP3),再运行 Whisper 转录。同时兼容命令行和 Python API,还提供了 yt-whisper 等替代工具。适用于任何支持 Python 和 ffmpeg 的平台,需要安装 openai-whisper 和 yt-dlp,对 GPU(CUDA)有加速支持。

兼容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/TerminalSkills/skills/youtube-transcription

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

YouTube 视频转录

使用 OpenAI Whisper 和 yt-dlp 将 YouTube 视频转录为文本。

概述

该技能使用 yt-dlp 下载 YouTube 视频的音频,并使用 OpenAI 的 Whisper 模型进行转录。支持多种输出格式(txt、srt、vtt、json)以及不同大小的模型,可在精度和速度之间进行权衡。

说明

1. 安装依赖

# 安装 whisper 和 yt-dlp
pip install openai-whisper yt-dlp

# 验证 ffmpeg 是否已安装(音频处理所需)
ffmpeg -version

如果缺少 ffmpeg:

2. 从 YouTube 下载音频

# 下载最佳音质为 WAV 格式
yt-dlp -x --audio-format wav -o "%(title)s.%(ext)s" "YOUTUBE_URL"

# 下载为 MP3 格式(文件更小)
yt-dlp -x --audio-format mp3 -o "%(title)s.%(ext)s" "YOUTUBE_URL"

# 以视频 ID 作为文件名下载(避免特殊字符问题)
yt-dlp -x --audio-format wav -o "%(id)s.%(ext)s" "YOUTUBE_URL"

3. 选择 Whisper 模型

模型参数显存相对速度适用场景
tiny39M~1 GB~32x快速草稿、测试
base74M~1 GB~16x快速转录
small244M~2 GB~6x平衡之选
medium769M~5 GB~2x高准确率
large1550M~10 GB1x最佳准确率

仅限英文的模型(tiny.en、base.en、small.en、medium.en)在处理英文内容时速度更快。

4. 运行转录

命令行方式:

# 基础转录(自动检测语言)
whisper audio.wav --model medium

# 指定语言以提高准确率
whisper audio.wav --model medium --language en

# 指定输出格式
whisper audio.wav --model medium --output_format srt

# 同时生成所有格式
whisper audio.wav --model medium --output_format all

# 指定输出目录
whisper audio.wav --model medium --output_dir ./transcripts

Python 方式:

import whisper

# 加载模型(首次运行会自动下载)
model = whisper.load_model("medium")

# 转录
result = model.transcribe("audio.wav", language="en")

# 获取纯文本
print(result["text"])

# 获取带时间戳的片段
for segment in result["segments"]:
    print(f"[{segment['start']:.2f} - {segment['end']:.2f}] {segment['text']}")

5. 一键流水线

将下载与转录合并:

# 一步完成下载和转录
yt-dlp -x --audio-format wav -o "audio.wav" "YOUTUBE_URL" && whisper audio.wav --model medium --output_format all

6. 备选方案:yt-whisper 工具

如需更简单的工作流,可使用专门的 yt-whisper 包:

# 安装
pip install git+https://github.com/m1guelpf/yt-whisper.git

# 直接从 URL 转录
yt_whisper "https://www.youtube.com/watch?v=VIDEO_ID"

# 带选项的转录
yt_whisper "YOUTUBE_URL" --model medium --language en --output_format srt

输出格式

格式扩展名描述
txt.txt纯文本转录稿
srt.srtSubRip 字幕格式(带时间戳)
vtt.vttWebVTT 字幕格式
tsv.tsv制表符分隔值
json.json包含逐词时间戳的完整数据

示例

指南

  • 当你知道视频使用的语言时,请使用 --language 标志,这能显著提高准确率
  • 对于长视频(超过 1 小时),使用 small 或 medium 模型以平衡速度和准确率
  • 仅限英文的模型(.en 后缀)在处理英文内容时更快且更准确
  • 配备 CUDA 的 GPU 可大幅加速转录;CPU 也能工作,但速度慢 5-10 倍
  • 如果转录失败,请确保 ffmpeg 已正确安装且在 PATH 中
  • 对于背景音乐较多的视频,较大的模型(medium/large)处理效果更好
  • 转录后清理音频文件以节省磁盘空间
  • 使用 --output_format all 一次获取所有格式,然后选择你需要的

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能