Skip to main content

Process subtitle files with ease.

Project description

Subtitle Alchemy

Subtitle Alchemy is a Python-based tool that automates subtitle generation for audio and video content using the FunASR Speech-to-Text (STT) model, along with a feature that aligns a pre-written transcript with the audio track for accurate subtitling.

Features

  • Automatic Subtitle Creation: Generates subtitles from audio/video using FunASR's STT.
  • Transcript Matching (文稿匹配): Aligns manually prepared transcripts with audio for precise subtitle timing.

Installation

You can install via pip:

pip install -U subtitle-alchemy

Or install from source:

git clone https://github.com/ppmzhang2/subtitle-alchemy && cd subtitle-alchemy
pip install -e .

Usage

Transcribe an audio or video and save the sketch. The output will be an npz file saved in the specified directory with the same base name as the input file:

subalch transcribe path_to_your_media output_dir --hotword "热词"

Generate the subtitle from the sketch. The output will be saved in the specified directory with the same base name as the input file. The --form option allows you to specify the output format (e.g., srt, ass, vtt, etc.), and the --threshold option sets the minimum silence duration (in milliseconds) to split the subtitles:

subalch generate path_to_sketch.npz output_dir --form srt --threshold 500

For transcript alignment, simply provide the path to the sketch and the transcript file:

subalch align path_to_sketch.npz path_to_transcript --form srt --threshold 500

Dependencies

  • Python 3.11+

Contributing

Pull requests are welcome! For major changes, please open an issue to discuss what you'd like to change.

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

subtitle_alchemy-0.1.30.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

subtitle_alchemy-0.1.30-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file subtitle_alchemy-0.1.30.tar.gz.

File metadata

  • Download URL: subtitle_alchemy-0.1.30.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.10

File hashes

Hashes for subtitle_alchemy-0.1.30.tar.gz
Algorithm Hash digest
SHA256 ab4b7fa5ce894e8ea0a94c4e2aa8d933a93f6a91f2720187b1740c162cd67ac9
MD5 4895565b2b7cccbe47b62d503d24890b
BLAKE2b-256 b6398971b7cc5037f2a5cc8f90303f5762d896d2138b40491b56c91f5adb855f

See more details on using hashes here.

File details

Details for the file subtitle_alchemy-0.1.30-py3-none-any.whl.

File metadata

File hashes

Hashes for subtitle_alchemy-0.1.30-py3-none-any.whl
Algorithm Hash digest
SHA256 3564367fed33f00b09bc998605d3424b5a7540a9fa6e6147b63cc6a49518d7d8
MD5 9c2ac92be2bb89a9fcb1e95815767f40
BLAKE2b-256 bfcbc6a505bbdc978b37b76c14e1ea374893a0e4953eaaf3a5fae5b7789ce3c9

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