feat: enable diarization by default with an opt-out
Request speaker diarization through OpenRouter's Azure provider options for all transcription uploads. Add --no-diarization to explicitly disable it for both plain text and SRT output; returned speaker labels let existing SRT cue generation split at speaker changes. Default to 10-minute chunks when diarization is enabled because Microsoft reports failures around 15 minutes and longer. Preserve the 30-minute default with the opt-out and honor explicit --chunk-minutes values in both modes. Document the options, duration limits, and output behavior. Test Plan: - python3 -B -m unittest -v: all 32 tests passed, including request options, default upload limits, opt-out combinations, and SRT speaker boundaries. - bash -n transcribe: passed. - ./transcribe --help: verified the new option and chunk defaults. - git diff --cached --check: passed. - Provider responses were mocked; no live API request was made.
This commit is contained in:
1 parent
a5c535cfb9
commit
24b1030776
4 files changed
+121
-10
No files matched your search
@@ -8,6 +8,8 @@ the 1Password CLI (`op`) from `op://API Keys/openrouter-mai-transcribe-2/credent
|
||||
./transcribe recording.m4a
|
||||
./transcribe video.mp4 > transcript.txt
|
||||
./transcribe --srt video.mp4 > subtitles.srt
|
||||
./transcribe --no-diarization recording.m4a > transcript.txt
|
||||
./transcribe --srt --no-diarization video.mp4 > subtitles.srt
|
||||
./transcribe --chunk-minutes 10 too_long.webm > transcript.txt
|
||||
```
|
||||
|
||||
@@ -18,10 +20,23 @@ and sends it to OpenRouter's `microsoft/mai-transcribe-2` model. Temporary
|
||||
files are removed on exit. The transcript goes to stdout; progress and errors
|
||||
go to stderr. Output is emitted only after all requests and conversion succeed.
|
||||
|
||||
Long recordings are automatically split into uploads of at most **30 minutes**,
|
||||
including overlap and MP3 padding. Use `--chunk-minutes N` (an integer from 1 to
|
||||
30) to lower the limit. At 64 kbps, a 30-minute upload is about 14.4 MB of MP3
|
||||
or 19.2 MB of base64. This is a local default, not a guaranteed provider limit:
|
||||
Speaker diarization is **enabled by default** through
|
||||
`provider.options.azure.diarization.enabled`, following
|
||||
[OpenRouter's speaker diarization API](https://openrouter.ai/docs/guides/overview/multimodal/stt#verbose-transcripts-timestamps-and-speakers).
|
||||
Use `--no-diarization` to explicitly disable it for every request, with either
|
||||
plain text or `--srt` output. SRT uses returned speaker labels to break cues at
|
||||
speaker changes; neither output format prints speaker names or IDs.
|
||||
|
||||
Long recordings are automatically split into uploads of at most **10 minutes**
|
||||
with diarization, or **30 minutes** with `--no-diarization`, including overlap
|
||||
and MP3 padding. These defaults account for
|
||||
[Microsoft's documented diarization failures around 15 minutes and longer](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/mai-transcribe).
|
||||
Use `--chunk-minutes N` (an integer from 1 to 30) to override the limit in either
|
||||
mode. Larger chunks with diarization may fail with a timeout or
|
||||
`diarization_unavailable`; reduce the chunk size or use `--no-diarization`.
|
||||
At 64 kbps, a 10-minute upload is about 4.8 MB of MP3 or 6.4 MB of base64;
|
||||
a 30-minute upload is about 14.4 MB of MP3 or 19.2 MB of base64.
|
||||
These are local defaults, not guaranteed provider limits:
|
||||
[OpenRouter documents a 60-second processing timeout](https://openrouter.ai/docs/guides/overview/multimodal/stt),
|
||||
so reduce the chunk size if requests still time out.
|
||||
|
||||
|
||||
Reference in new issue
Block a user