Skip to main content

Generate subtitles from audio/video using Soniox Speech-to-Text API

Project description

soniox-transcribe

CLI tool for generating subtitles from audio/video files using the Soniox Speech-to-Text API.

Features

  • Subtitle formats: SRT, VTT, TXT
  • Video support: Automatically extracts audio from video files via ffmpeg
  • Speaker diarization: Speaker labels enabled by default
  • 60+ languages: With automatic language identification
  • Context support: Custom terms and background text to improve accuracy (up to ~8,000 tokens)

Installation

pip install soniox-transcribe

For video file support, ffmpeg must be installed:

# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt install ffmpeg

Configuration

Set your Soniox API key as an environment variable:

export SONIOX_API_KEY=<your-api-key>

Get your API key at console.soniox.com.

Alternatively, create a .env file in your working directory:

SONIOX_API_KEY=<your-api-key>

Usage

# Basic transcription (outputs .srt by default)
soniox-transcribe video.mp4

# Specify output file (format inferred from extension)
soniox-transcribe video.mp4 -o video.vtt

# Explicit format
soniox-transcribe audio.wav -f txt

# Transcribe from URL
soniox-transcribe --url https://example.com/audio.mp3

# Disable speaker diarization
soniox-transcribe interview.wav --no-speaker

# Add custom vocabulary
soniox-transcribe lecture.mp3 -t "Transformer" -t "BERT" -t "GPT"

# Provide background text for better accuracy
soniox-transcribe meeting.mp3 --context-text "Discussion about Q4 revenue targets"

# Use a context file
soniox-transcribe meeting.mp3 --context-text-file agenda.txt

Options

Option Description
-o, --output Output file path (default: input with .srt extension)
-f, --format Output format: srt, vtt, txt
-u, --url Transcribe from a public URL instead of a local file
-l, --language Language hints (default: zh, en); repeatable
--no-speaker Disable speaker diarization and labels
--max-chars Max characters per subtitle line (default: 42)
-m, --model Soniox model (default: stt-async-v4)
-t, --context-term Custom terms/vocabulary; repeatable
--context-text Background text for accuracy improvement
--context-text-file File containing background text
-c, --context JSON string with full context configuration
--context-file JSON file with full context configuration

Supported Formats

Audio: mp3, wav, flac, aac, ogg, m4a, wma

Video: mp4, mkv, avi, mov, webm, flv, wmv, m4v (requires ffmpeg)

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

soniox_transcribe-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

soniox_transcribe-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file soniox_transcribe-0.1.0.tar.gz.

File metadata

  • Download URL: soniox_transcribe-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for soniox_transcribe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 624f67c1830ab98180e526f91752159300dadcad27a5cef81a741ecd6c7347a9
MD5 a83b7e2441bd82f96b229169f7fae61d
BLAKE2b-256 f98c8734173658e38207f7ca81315253d3cf781d1a5a5463f439bc6f7ea50b0d

See more details on using hashes here.

File details

Details for the file soniox_transcribe-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for soniox_transcribe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1450b47cc2e689c362c9514381d4811d22a96d5bb65ceaaa655a665cca6619f6
MD5 a5717aef2fa4b4460d48f6265f419e69
BLAKE2b-256 7db63648dfff1a64f0da6eea79632459964fb4a2b786815e8b7c37d5e95744fa

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