Skip to main content

A tool for downloading YouTube audio, generating subtitles, and sending them to an HTTP endpoint.

Project description

ASB Auto Subs

ASB Auto Subs is a tool for generating subtitles from YouTube videos using whisper locally, or groq remotely. It monitors the clipboard for YouTube links, as well as file path (shift right click "copy as path" on windows), gets the audio, and generates subtitles in .srt format. The project also integrates with the ASBPlayer WebSocket server for automatically loading subtitles.

Currently Hard-coded for japanese, but you can change it in groq_sub_gen/local.py or groq_sub_gen/remote.py to any language you want.

Getting Started

Install the Package

To get started, pip install the package:

pip

pip install asb-groq-sub

uv

uv tool install asb-groq-sub

Requirements

  • Python 3.11+
  • ffmpeg installed and available in your system's PATH
  • go installed and available in your system's PATH (for the asbplayer websocket server)

Configure config.yaml

Before running the project, you need to configure the config.yaml file. This file contains essential settings, changing how asb-auto-subs will behave.

This will be generated on first run if it doesn't exist (idk where).

  1. Open the config.yaml file in a text editor .
  2. Update the configuration values as needed. For example:
    process_locally: true
    whisper_model: "small"
    GROQ_API_KEY: ""
    RUN_ASB_WEBSOCKET_SERVER: true
    model: "whisper-large-v3-turbo"
    # model: "whisper-large-v3"
    output_dir: "output"
    language: "ja"
    skip_language_check: false
    cookies: ""
    
  3. Save the file.

What Each Config Does:

  • process_locally: Determines if the transcription is done locally or via the groq API.
  • whisper_model: The whisper model to use for local transcription.
  • GROQ_API_KEY: Your API key for accessing Groq's services.
  • RUN_ASB_WEBSOCKET_SERVER: Whether to run the ASBPlayer WebSocket server.
  • model: The groq transcription model to use.
  • output_dir: Directory where output files are saved.
  • language: Language code for transcription. Also used to check if the video's language is what we want.
  • skip_language_check: When true, bypasses YouTube metadata language validation entirely.
  • cookies: Cookies for authenticated yt-dlp requests.

Setup API Usage

Where to get Groq API Key? (REQUIRED)

Can sign up here https://console.groq.com/ and after sign up it will ask you to generate an api key.

Run the Script

The script monitors your clipboard for YouTube links. When a valid YouTube link is detected, it automatically downloads the audio, generates subtitles, saves them, and then sends them to the ASBPlayer WebSocket server.

To start the script:

asb-groq-sub

ASBPlayer WebSocket Server

This project integrates with the ASBPlayer WebSocket server for subtitle synchronization. You can find more information about ASBPlayer and its WebSocket server here.

Contact

If you run into issues, you can make an issue here.

Credits

Donations

If you've benefited from this or any of my other projects, please consider supporting my work via Github Sponsors or Ko-fi.

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

asb_auto_subgen-1.0.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

asb_auto_subgen-1.0.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file asb_auto_subgen-1.0.0.tar.gz.

File metadata

  • Download URL: asb_auto_subgen-1.0.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for asb_auto_subgen-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f310d8035ef9804dd151f3f08ed874fc158c7ccfabfc602152460c0b86d962c2
MD5 fe85d27b7b1f3d16b532e0814d49290d
BLAKE2b-256 6393f4e735f765ab090edeacb879cc7eff781d78f58cd0de5e2824a94e7fecca

See more details on using hashes here.

File details

Details for the file asb_auto_subgen-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: asb_auto_subgen-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for asb_auto_subgen-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b69e502fd26f67d65d50ef7740c659affbb3c2f1aa04dc8782547ee9fa3ba03
MD5 e7fd2b52c0a5d52d73194a379042f79b
BLAKE2b-256 b7241284e6389e2a01234e3ff396d1ea569d22a5710634c11ea681917aac8aeb

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