Skip to content

hygt/autosrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autosrt

Simple CLI tool in Rust for automatic subtitle generation. Both transcription and translation are supported.

Models

  • Speech-to-text: NVIDIA Canary
  • Text translation: Google TranslateGemma

Dependencies

FFmpeg.

Usage

Requirements

It's best to pre-download models from HuggingFace using the CLI:

hf download istupakov/canary-1b-v2-onnx
hf download onnx-community/translategemma-text-4b-it-ONNX

CLI

To generate subtitles for a video file, run the following commands:

# Transcribe video to SRT
autosrt --input video.mp4 --model istupakov/canary-1b-v2-onnx

# Translate existing SRT file
autosrt --input subtitles.srt --translate-model onnx-community/translategemma-text-4b-it-ONNX

# Transcribe and translate in one step
autosrt --input video.mp4 --model istupakov/canary-1b-v2-onnx --translate-model onnx-community/translategemma-text-4b-it-ONNX

Options

Option Short Description Default
--input -i Input video file or SRT file (required)
--output -o Output SRT file path Input filename with .srt extension
--model -m Path or ID of Canary model (required for video transcription)
--translate-model -t Path or ID of TranslateGemma model (optional, enables translation)
--source-lang -s Source language code for translation fi
--target-lang -l Target language code for translation en
--debug -d Save downsampled audio to file for debugging (off)

Examples

# Transcribe Finnish video to English subtitles
autosrt -i video.mp4 -m istupakov/canary-1b-v2-onnx

# Transcribe and translate from Finnish to German
autosrt -i video.mp4 -m istupakov/canary-1b-v2-onnx -t onnx-community/translategemma-text-4b-it-ONNX -s fi -l de

# Translate existing SRT from Spanish to English
autosrt -i subtitles.srt -t onnx-community/translategemma-text-4b-it-ONNX -s es -l en -o translated.srt

# Custom output path
autosrt -i video.mp4 -m istupakov/canary-1b-v2-onnx -o custom_subtitles.srt

# Save debug audio files
autosrt -i video.mp4 -m istupakov/canary-1b-v2-onnx -d

Language Codes

Common language codes:

Code Language Code Language
en English de German
fi Finnish es Spanish
sv Swedish fr French
no Norwegian it Italian
da Danish pt Portuguese
ru Russian ja Japanese
zh Chinese ko Korean
ar Arabic hi Hindi

About

Automatic media transcription and translation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages