Skip to main content

Download YouTube videos, generate and translate subtitles

Project description

yt-srt-gen

yt-srt-gen is a tool for downloading YouTube videos, generating subtitles using OpenAI Whisper, and translating them into another language (e.g., English) automatically.

Features

  • Download YouTube videos using yt-dlp.
  • Generate subtitles with OpenAI Whisper.
  • Translate subtitles to a target language using googletrans.
  • Supports multiple subtitle formats: srt, vtt, txt, tsv, json.

Installation

pip install yt-srt-gen

Install openai-whisper if not installed.

pip install openai-whisper

yt-srt-gen requires openai-whisper, but it doesn't ship it as a dependency to save up disk space when both packages are needed separately and installed via pipx.

Usage

yt-srt-gen <YouTube URL> [OPTIONS]

Arguments

  • <YouTube URL>: URL of the YouTube video.

Options

  • --source-language, -s: Language spoken in the audio.
  • --target-language, -t: Language for translated subtitles.
  • --output-format, -f: Subtitle output format (txt, vtt, srt, tsv, json, all, default: srt).
  • --whisper-args, -w: Additional arguments to pass to openai-whisper.

Examples

yt-srt-gen https://www.youtube.com/watch?v=dQw4w9WgXcQ --source-language es --target-language en --output-format srt
yt-srt-gen https://www.youtube.com/watch?v=dQw4w9WgXcQ -s sr -t en -w "--model small --fp16 False"

This will download the video, generate Spanish subtitles, and append English translations.

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_srt_gen-0.1.9.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

yt_srt_gen-0.1.9-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file yt_srt_gen-0.1.9.tar.gz.

File metadata

  • Download URL: yt_srt_gen-0.1.9.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yt_srt_gen-0.1.9.tar.gz
Algorithm Hash digest
SHA256 f4abd540463abedc509a596c81462ce01d9e723a730d205429df3b9f6e28b40c
MD5 43b877c9a446ff857e8591f36b7954a3
BLAKE2b-256 316c22371a71a8014a769a7934f777252df9fa97c39036234dbeca70ee8b9099

See more details on using hashes here.

File details

Details for the file yt_srt_gen-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: yt_srt_gen-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yt_srt_gen-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 90cbdfe14e1de35381f67c0c9dc818d12a654d4fa3e7362d896140bf8717698b
MD5 54475de8d14e2775615eb5f4fa92dfbb
BLAKE2b-256 addca0e445a319096216da83f55e5e38a4dbe000be35ae9c1982393d8992294d

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