Skip to main content

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

Metadata

Release files for subtitle-alchemy 0.1.30

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subtitle-alchemy 0.1.30
File Size Uploaded
subtitle_alchemy-0.1.30.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subtitle-alchemy 0.1.30
File Interpreter ABI Platform
subtitle_alchemy-0.1.30-py3-none-any.whl Python 3 none any Details

Total release size: 47.0 kB

Release files / subtitle_alchemy-0.1.30.tar.gz

Download URL subtitle_alchemy-0.1.30.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ab4b7fa5ce894e8ea0a94c4e2aa8d933a93f6a91f2720187b1740c162cd67ac9
BLAKE2b-256 checksum
How to use checksums
b6398971b7cc5037f2a5cc8f90303f5762d896d2138b40491b56c91f5adb855f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.10

Release files / subtitle_alchemy-0.1.30-py3-none-any.whl

Download URL subtitle_alchemy-0.1.30-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3564367fed33f00b09bc998605d3424b5a7540a9fa6e6147b63cc6a49518d7d8
BLAKE2b-256 checksum
How to use checksums
bfcbc6a505bbdc978b37b76c14e1ea374893a0e4953eaaf3a5fae5b7789ce3c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.10

Release history Release notifications | RSS feed

This release

0.1.30 This release

2 release files

0.1.20

2 release files

0.1.10

2 release files

0.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page