Repolode
zh-plus

zh-plus/openlrc

Python library that transcribes audio with faster-whisper, then translates and polishes the text into LRC or subtitle files using LLMs like OpenAI, Anthropic, and Google.

Stars
685
Forks
54
Open issues
6
Last commit
3 months ago

What is it?

OpenLRC turns audio and video into timed subtitle files. It transcribes speech with faster-whisper, then sends the text to a large language model to translate or polish it, producing .lrc lyric files or .srt subtitles. Users can supply OpenAI, Anthropic, Google, or OpenRouter API keys, and custom OpenAI-compatible endpoints or LiteLLM routing are also supported.

The translation step keeps context across segments, processing each file sequentially so earlier lines inform later ones. A glossary file lets users enforce domain-specific terms, such as game names or proper nouns. Audio is loudness-normalized before transcription to reduce hallucinations, with optional noise suppression through an extra install.

The library is installable from PyPI and exposes a Python API centered on the LRCer class, which can run on one or many files, produce bilingual subtitles, or skip translation entirely.

Key features

  • 01Transcribes audio and video with faster-whisper before translation.
  • 02Translates or polishes subtitles with OpenAI, Anthropic, Google, OpenRouter, or custom endpoints.
  • 03Supports glossary files for consistent domain-specific terminology.
  • 04Outputs .lrc lyric files and .srt subtitles, including bilingual subtitles.
  • 05Applies loudness normalization and optional noise suppression to input audio.
  • 06Offers a lean translation mode with mixed-model setups for token efficiency.

Use cases

  • Creating synchronized translated lyrics for songs in a music library.
  • Generating translated subtitles for videos or podcasts in another language.
  • Producing bilingual subtitle files for language learning.
  • Batch-processing a folder of recordings through a Python script.

Quick start

  1. 1

    Install ffmpeg and add its bin directory to PATH

  2. 2

    Add an LLM API key, such as OPENROUTER_API_KEY, to your environment

  3. 3

    Install openlrc from PyPI

    pip install openlrc
  4. 4

    Run LRCer on an audio file to generate translated subtitles

Things to know

  • Requires an LLM API key from a paid provider for translation.
  • Needs CUDA and cuDNN for GPU-accelerated transcription with faster-whisper.
  • Requires ffmpeg installed and on PATH.

In collections

Topics

#speech-to-text#whisper#subtitle#llm#translation#lyrics#audio#auto-subtitle#faster-whisper#lyrics-generator

FAQ

What is openlrc?
Python library that transcribes audio with faster-whisper, then translates and polishes the text into LRC or subtitle files using LLMs like OpenAI, Anthropic, and Google. OpenLRC turns audio and video into timed subtitle files. It transcribes speech with faster-whisper, then sends the text to a large language model to translate or polish it, producing .lrc lyric files or .srt subtitles. Users can supply OpenAI, Anthropic, Google, or OpenRouter API keys, and custom OpenAI-compatible endpoints or LiteLLM routing are also supported.
Is openlrc free to use? What license does it have?
openlrc is open source under the MIT license. Check the license terms before using it in commercial products.
Is openlrc still maintained?
Updated within 6 months. The last commit to openlrc was on Aug 10, 2026.
What can I use openlrc for?
Creating synchronized translated lyrics for songs in a music library. Generating translated subtitles for videos or podcasts in another language. Producing bilingual subtitle files for language learning. Batch-processing a folder of recordings through a Python script.
How do I install openlrc?
Install ffmpeg and add its bin directory to PATH Add an LLM API key, such as OPENROUTER_API_KEY, to your environment Install openlrc from PyPI: pip install openlrc Run LRCer on an audio file to generate translated subtitles
Where can I get openlrc?
The source code and installation instructions are on GitHub: https://github.com/zh-plus/openlrc

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects