From 451d3dea70ed2666f9119528833d137d9643ff87 Mon Sep 17 00:00:00 2001 From: kingston Date: Mon, 2 Nov 2026 16:13:08 -0600 Subject: [PATCH] transcribe: document video support and shallow source lookup Completes the video-source fix: the command help and README still promised a 25-message scan, and the low-confidence branch was missing the message provenance line the other replies carry. --- README.md | 2 +- transcribe/transcribe.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f28025..f0eae4b 100644 --- a/README.md +++ b/README.md @@ -1352,7 +1352,7 @@ Transcribe Discord voice messages with Whisper, and optionally translate them wi - `[p]translate ` - Translate the message you reply to (or text you type), with the source language detected automatically. Add `from ` when detection is unsure or you want to be explicit. - `[p]transcribeset showoriginal ` - Show the original text under a translation (default: on). -Reply to a voice message, or just run the command and the newest voice message within the last 25 messages is used. Attachments are accepted too, as long as they are audio (`ogg`, `opus`, `wav`, `mp3`, `m4a`, `flac`, `webm`). +Reply to a voice message or video, or attach one to the command. Running the command bare uses the message posted immediately before it - it never reaches further back, so it cannot quietly transcribe an older clip. Audio and video attachments are accepted (`ogg`, `opus`, `wav`, `mp3`, `m4a`, `flac`, `aac`, `wma`, and the video containers `mp4`, `mov`, `m4v`, `mkv`, `webm`, `avi`, `mpeg`, `mpg`); Whisper decodes the audio track out of video files. Each reply names the message it transcribed. The cog talks to two local services: diff --git a/transcribe/transcribe.py b/transcribe/transcribe.py index 158e6c9..971faf4 100644 --- a/transcribe/transcribe.py +++ b/transcribe/transcribe.py @@ -32,7 +32,7 @@ MAX_TRANSLATE_CHARS = 8000 # send videos expecting them to be transcribed. MEDIA_EXTENSIONS = ( ".ogg", ".opus", ".wav", ".mp3", ".m4a", ".flac", ".aac", ".wma", - ".mp4", ".mov", ".m4v", ".mkv", ".webm", ".avi", + ".mp4", ".mov", ".m4v", ".mkv", ".webm", ".avi", ".mpeg", ".mpg", ) # Below this, Whisper is guessing which language it heard. Translating from a @@ -339,8 +339,8 @@ class Transcribe(commands.Cog): async def transcribe(self, ctx: commands.Context, *, language: Optional[str] = None): """Transcribe a voice message, or translate it into another language. - Reply to a voice message, or just run it and the most recent one in the - channel is used. + Reply to a voice message or video, or attach one to the command. Running + it bare uses the message posted immediately before it. **Examples** `[p]transcribe` — transcribe and translate to English @@ -415,6 +415,7 @@ class Transcribe(commands.Cog): f"I only detected **{self._label(detected)}** " f"({confidence:.0%} confident), so I won't translate from a guess.\n" f"{self._clip(source_text, 1600)}" + f"{origin}" ) return