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

We recommend using Conda to manage the dependencies. Clone the repository and create a new Conda environment using the provided conda-gpu-subalch-py310.yaml file:

git clone https://github.com/ppmzhang2/sub-alchemy.git
cd sub-alchemy
conda env create -f conda-gpu-subalch-py310.yaml
conda activate py310-gpu-subalch

For CPU-only installations, simply use pip from PyPI:

pip install sub-alchemy[cpu]

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.10

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.20.tar.gz (21.2 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.20-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for subtitle_alchemy-0.1.20.tar.gz
Algorithm Hash digest
SHA256 2150d04e6f2f1975530896f0433536ec828bb56df58f5fefecf0688f9568bb25
MD5 fa45a6c49970843fb07e2f20507c0c97
BLAKE2b-256 6430eda6906df35106042cf2f8f8fe6f770cbc8c77fa4476e5f5898d61d9c742

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for subtitle_alchemy-0.1.20-py3-none-any.whl
Algorithm Hash digest
SHA256 a924334e023f84b9f3e4dc11d200a9424445cebe504d49ecbd7d121c8355af23
MD5 052fbf934a3b4ea84aca0dd4e6e0146b
BLAKE2b-256 2797eea725af09a7465fffaee99456d43cc0fed5996d17cdfa3b4b42fc3dd5de

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