A library for transcribing audio files using Whisper models
Project description
Whisper Transcriber
A Python library for transcribing audio files using Whisper models with intelligent silence detection and segmentation.
Installation
pip install whisper-transcriber
Requirements
- Python 3.7 or higher
- ffmpeg and ffprobe installed on your system
Features
- Intelligent silence detection for natural segmentation
- Adaptive audio analysis for optimal threshold detection
- High-quality transcription using Whisper models
- Support for various audio formats
- SRT subtitle output
Usage
Command Line
# Basic usage
whisper-transcribe audio_file.mp3
# Advanced usage
whisper-transcribe audio_file.mp3 -o transcript.srt -m openai/whisper-small \
--min-segment 5 \
--max-segment 15 \
--silence-duration 0.2 \
--sample-rate 16000 \
--batch-size 8 \
--normalize \
--hf-token YOUR_HF_TOKEN \
--no-transcripts \
--no-timestamps
Available Arguments:
input: Input audio file or directory (required)-o, --output: Output file path (default: input filename with .srt extension)-m, --model: Whisper model to use (default: openai/whisper-small)--hf-token: HuggingFace API token--min-segment: Minimum segment length in seconds (default: 5)--max-segment: Maximum segment length in seconds (default: 15)--silence-duration: Minimum silence duration in seconds (default: 0.2)--sample-rate: Audio sample rate (default: 16000)--batch-size: Batch size for transcription (default: 8)--normalize: Normalize audio volume--no-text-normalize: Skip text normalization--no-transcripts: Don't print transcripts during processing--no-timestamps: Don't print timestamps during processing
Python Library
from whisper_transcriber import WhisperTranscriber
# Initialize the transcriber
transcriber = WhisperTranscriber(model_name="openai/whisper-small", hf_token="YOUR_HF_TOKEN")
# Transcribe an audio file
results = transcriber.transcribe(
"audio_file.mp3",
output="transcript.srt",
min_segment=5,
max_segment=15,
silence_duration=0.2,
sample_rate=16000,
batch_size=8,
normalize=True,
normalize_text=True,
print_transcripts=True,
print_timestamps=True
)
# Access the transcription results
for i, segment in enumerate(results):
print(f"Segment {i+1}: {segment['transcript']}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
whisper_transcriber-0.1.3.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whisper_transcriber-0.1.3.tar.gz.
File metadata
- Download URL: whisper_transcriber-0.1.3.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25b784c97b7277bc25ddf938c1ed369fec60ab47337c2eddd622b40ef85a0248
|
|
| MD5 |
5e5993925992cbb76f718a264166d18d
|
|
| BLAKE2b-256 |
6935562b61d4b6c7471d1e4e57d3598989103f03f1b47276bf8c63b95318464a
|
File details
Details for the file whisper_transcriber-0.1.3-py3-none-any.whl.
File metadata
- Download URL: whisper_transcriber-0.1.3-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24423923da65f8a76145256cef2e58bdaeee26324b41624c77ed73b7d1b0e750
|
|
| MD5 |
22acb456c19a954b82de30bb07b2c3a0
|
|
| BLAKE2b-256 |
8d901010ae295151b60c874ab51f6da312f830c9a972c1873414ee1f2318a89c
|