Skip to main content

Extract text from YouTube videos using Whisper

Project description

yt-whisper

Transcribe any YouTube video to text in one command.

PyPI Python License: MIT

yt-whisper downloads the audio from a YouTube URL and runs it through faster-whisper (CTranslate2 backend — comparable speed to whisper.cpp) or Moonshine for English-only content. Output can be plain text, SRT/VTT subtitles, or JSON with timestamps.


Features

  • One command — paste a URL, get a transcript
  • Multiple models — tiny to large-v3-turbo (Whisper) or Moonshine for ultra-fast English transcription
  • Multiple formats.txt, .srt, .vtt, .json, or all at once
  • Auto language detection — or force a specific language
  • Translation — translate any language to English via Whisper
  • GPU support — CUDA auto-detected, or force cpu/cuda/auto
  • Rich terminal UI — progress spinners, video metadata panel, transcription stats

Requirements

  • Python 3.9+
  • ffmpeg — required for audio extraction
# macOS
brew install ffmpeg

# Ubuntu / Debian
sudo apt install ffmpeg

# Windows
winget install ffmpeg

Installation

pip install yt-whisper

With Moonshine support (English-only, faster on short clips):

pip install 'yt-whisper[moonshine]'

Install from source:

git clone https://github.com/V0latix/YT-Whisper
cd YT-Whisper
pip install -e .

Quick Start

yt-whisper "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

The transcript is printed to the terminal and saved as <video-title>.txt in the current directory.


Usage

yt-whisper [OPTIONS] URL

Options

Flag Short Default Description
--model -m base Model name (see Models)
--language -l auto Force language code, e.g. fr, en
--task -t transcribe transcribe or translate (→ English)
--output-dir -o . Directory to save output files
--format -f txt txt, srt, vtt, json, or all
--device -d auto cpu, cuda, or auto
--print/--no-print -p print Print transcript to stdout
--version -v Show version and exit

Examples

# Basic transcription → saves <title>.txt
yt-whisper "https://youtube.com/watch?v=..."

# Higher accuracy with a larger model
yt-whisper "https://youtube.com/watch?v=..." --model large-v3

# Generate SRT subtitles
yt-whisper "https://youtube.com/watch?v=..." --format srt

# Generate every format at once
yt-whisper "https://youtube.com/watch?v=..." --format all

# Force French, then translate to English
yt-whisper "https://youtube.com/watch?v=..." --language fr --task translate

# Save files to a specific folder
yt-whisper "https://youtube.com/watch?v=..." --output-dir ./transcripts

# Run on GPU
yt-whisper "https://youtube.com/watch?v=..." --device cuda

# Silent — save file only, no stdout
yt-whisper "https://youtube.com/watch?v=..." --no-print

# Use Moonshine for fast English-only transcription
yt-whisper "https://youtube.com/watch?v=..." --model moonshine-base

Models

Whisper — multilingual

Model Params Languages Relative speed
tiny 39 M multilingual ~32×
tiny.en 39 M English only ~32×
base 74 M multilingual ~16×
base.en 74 M English only ~16×
small 244 M multilingual ~6×
small.en 244 M English only ~6×
medium 769 M multilingual ~2×
medium.en 769 M English only ~2×
large-v1 1 550 M multilingual
large-v2 1 550 M multilingual
large-v3 1 550 M multilingual
large-v3-turbo 809 M multilingual ~2×

Moonshine — English-only ([moonshine] extra required)

Moonshine scales compute with audio length (unlike Whisper's fixed 30 s chunks), making it significantly faster for short clips.

Model Params WER
moonshine-tiny 26 M 12.7 %
moonshine-base 61 M 10.1 %

Models are downloaded automatically on first use and cached at ~/.cache/huggingface/.


Output Formats

Format Description
txt Plain text transcript
srt SubRip subtitles — for video players (VLC, mpv, …)
vtt WebVTT subtitles — for web players and YouTube
json Full data with per-segment timestamps
all All four formats at once

Output files are named after the video title and saved to the current directory (or --output-dir).


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_whisper-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_whisper-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file yt_whisper-0.1.0.tar.gz.

File metadata

  • Download URL: yt_whisper-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for yt_whisper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 047b2aaadb710ce1229a9140674db83a68a65f89a70e53d3a7efb268197b6ea2
MD5 243ee1112f03a61f0f231aa7b09a5741
BLAKE2b-256 2b131baf9e08efa2d252c173df6df1464f8ae061a9f968a7a450b4018b65100f

See more details on using hashes here.

File details

Details for the file yt_whisper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yt_whisper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for yt_whisper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9daa6963efaa42cc008ca3bfba05df60ef0afafc1b5015ff9002cdabf90e4e9f
MD5 3c8b4505a4ea5eecdb17cd95bd117c1d
BLAKE2b-256 350cbe3def5b1d8d1681a4417c5c94688ecb037d4ad042cf111e40de15a3770c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page