feat: add simple audio transcription command
Convert audio and video audio tracks to mono 16 kHz WAV with FFmpeg, then submit them to OpenRouter's MAI-Transcribe-2 endpoint. Read the API key from the environment and print the transcript to stdout for easy redirection. Store request payloads in temporary files to avoid shell argument size limits, and document dependencies and usage. Test Plan: - bash -n transcribe and shellcheck transcribe passed. - All eight documented formats passed local FFmpeg conversion and mocked API request/response checks, including WAV rate and channel validation. - git diff --cached --check passed. - No live API request was made.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Transcribe
|
||||
|
||||
Requires Bash, FFmpeg, curl, jq, and standard coreutils.
|
||||
|
||||
```sh
|
||||
export OPENROUTER_API_KEY='sk-or-v1-...'
|
||||
./transcribe recording.m4a
|
||||
./transcribe video.mp4 > transcript.txt
|
||||
```
|
||||
|
||||
Accepts m4a, mp4, aac, flac, opus, mp3, ogg, wav, and other formats your
|
||||
FFmpeg supports. Uses the first audio track, converts it to mono 16 kHz WAV,
|
||||
and sends it to OpenRouter's `microsoft/mai-transcribe-2` model. Temporary
|
||||
files are removed on exit. The transcript goes to stdout; errors to stderr.
|
||||
|
||||
One file per invocation; the whole recording is sent in one request, so
|
||||
the service's audio length and request size limits apply.
|
||||
|
||||
[OpenRouter model and API reference](https://openrouter.ai/microsoft/mai-transcribe-2)
|
||||
Reference in New Issue
Block a user