Skip to main content

YouTube Whisper - A YouTube Downloader with Transcription

Project description

🎥 YTWS: YouTube Download and Faster-Whisper Subtitle Generation Tool 🔥

YTWS is a tool provides a seamless way to download videos from YouTube and transcribe their audio content. It leverages the capabilities of yt-dlp for efficient video downloading and the faster-whisper for accurate transcription.

⭐ Features

  • Easy to Use: Start without any hassle.
  • Fast Subtitle Generation: Harness the speed of faster-whisper.
  • GPU Acceleration: A simple guide for harnessing GPU power.

⚙ Requirements

ffmpeg

For Python virtual environment (recommended):

conda install ffmpeg

For Windows scoop users:

scoop install ffmpeg

💽 Installation

Install YTWS easily with these commands:

pip install ytws

or

pip install git+https://github.com/faker2048/youtube-whisper.git

🚀 Usage

Downloading and Transcribing YouTube Videos/Audios

To download and transcribe a video, simply run:

 ytws dt --help
Usage: ytws dt [OPTIONS]

  Download video/audio from Youtube and generate subtitles.

Options:
  -u, --url TEXT         Youtube URL.  [required]
  -n, --threads INTEGER  Number of threads to use.
  -f, --format TEXT      Download format. See: https://github.com/yt-dlp/yt-
                         dlp#format-selection-examples
  -t, --translate        Translate the subtitles to English.
  -m, --model_name TEXT  Name of the model to use. e.g.  (tiny, tiny.en, base,
                         base.en, small, small.en,          medium, medium.en,
                         large-v1, or large-v2), recommended: (large-v2)
  -r, --model_root TEXT  Root directory for the models.
  --cpu                  Use CPU instead of GPU. This is useful if you do not
                         have a GPU.
  -s, --srt_only         Only generate subtitles. Do not download video.
  -v, --video_only       Only download video. Do not generate subtitles.
  --help                 Show this message and exit.

Example:

ytws dt -u "https://www.youtube.com/watch?v=XXXXXXXX" -m large-v2 # Download and transcribe the video
ytws dt -u "https://www.youtube.com/watch?v=XXXXXXXX" -f "bestvideo+bestaudio/best" 

After running the command, the media file and the generated subtitles will be saved in the same directory as the video file.

Only Downloading YouTube Videos/Audios

To download a video, simply run:

 ytws d --help
Usage: ytws d [OPTIONS]

  Download a video/audio from YouTube.

Options:
  -u, --url TEXT         The URL of the YouTube video or the filename to be
                         downloaded.  [required]
  -n, --threads INTEGER  The number of threads to use for downloading. Default
                         is 16.
  -f, --format TEXT      The download format. Options include:
                         'worstaudio[tbr>100]/bestaudio/best' for audio only,
                         'bestvideo[height>=1080]/bestvideo' for video only,
                         'bestvideo+bestaudio/best' for both video and audio
                         (default). Use 'best' for the best quality or specify
                         particular formats.
  --help                 Show this message and exit.

Only Transcribing Videos/Audios

To transcribe a video, simply run:

 ytws t --help
Usage: ytws t [OPTIONS]

  Transcribe a video/audio file.

Options:
  -f, --file TEXT        The media file to be transcribed.  [required]
  -t, --translate        Translate the subtitles to English.
  -m, --model_name TEXT  Name of the model to use. e.g.  (tiny, tiny.en, base,
                         base.en, small, small.en,          medium, medium.en,
                         large-v1, or large-v2), recommended: (large-v2)
  -r, --model_root TEXT  Root directory for the models.
  --cpu                  Use CPU instead of GPU. This is useful if you do not
                         have a GPU.
  --help                 Show this message and exit.

Example:

ytws t -f "video.mp4" -m large-v2

After running the command, the generated subtitles will be saved in the same directory as the video file.

🛫 GPU Acceleration

For easy CUDA and cuDNN installation:

  • Linux:
conda install cudnn
  • Windows:

Although using additional torch libraries may not be ideal, it's a straightforward approach for Windows (compared to Nvidia's official CUDA installation). Any alternative methods or suggestions are welcome!

pip3 install torch --index-url https://download.pytorch.org/whl/cu118

After these settings, YTWS should work with a GPU.

🪄 Available Models

Visit here for more details.

🌟 Contributing to YTWS

We welcome contributions to YTWS! Your support makes a difference.

How to Contribute

  • Fork, Clone, Branch: Start by forking and cloning the repository, then work in separate branches.
  • Commit: Follow the project standards and commit your changes.
  • Pull Request: Submit a concise pull request (PR) to the main branch.

Using Pre-Commit

To maintain code format:

pip install pre-commit
pre-commit install

Pre-commit will guide you through necessary checks and corrections. Feel free to reach out if you have any questions or suggestions!

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

ytws-0.3.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

ytws-0.3.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file ytws-0.3.2.tar.gz.

File metadata

  • Download URL: ytws-0.3.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for ytws-0.3.2.tar.gz
Algorithm Hash digest
SHA256 e80fff3809d604a9334fe2caa0b1847597056a7a0e3fad2e98a70e2d0065e3ef
MD5 bb96f6475aa4ecdbaade544a87a7ebc0
BLAKE2b-256 d533b6cf4d4ac6ef44f6a2b5a08597ac83103c78efd97aaf128cabf2d6000781

See more details on using hashes here.

File details

Details for the file ytws-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: ytws-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for ytws-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6d894343ba88fa61ad5cb069f0e59e2674c2356d8196293377ca5bfaa33ce9
MD5 6bcbd74f24f9d1fc85baf59bc80d0377
BLAKE2b-256 e9fd096e582d1413a68c2e75c7cbc3a2a943117138d2974b9c86f409ddaeedb0

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