aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AGENTS.md41
-rw-r--r--docs/superpowers/specs/2026-11-17-video-transcript-design.md3
-rwxr-xr-xexamples/tools/test-video.sh12
-rwxr-xr-xexamples/tools/video.sh13
-rw-r--r--examples/tools/video.toml2
5 files changed, 67 insertions, 4 deletions
diff --git a/AGENTS.md b/AGENTS.md
index b8bb2a4..7bba528 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -347,6 +347,47 @@ file's path, images included. Spec:
Tool call at 7-13 s (23 s for the WiFi one, longer reasoning), reply
1.7-3.3 s after it.
+### Video transcript tool, live check (2026-11-17)
+
+`video` (`examples/tools/video.sh`): a local video or a public URL to
+`$ASSISTANT_DIR/<slug>.md` (the daemon's `out_dir`, set in keystone),
+the path and the start of the text back to the model. Uploader
+subtitles (it/en) when a URL has them, else whisper large-v3-turbo on
+the CPU (`-ng -t 8`): no VRAM, the loaded model keeps the GPU. Asks
+before videos over 30 minutes. A stop now kills a running tool's process
+group. Spec: `docs/superpowers/specs/2026-11-17-video-transcript-design.md`.
+
+- Through a second daemon on a scratch socket, config, data and output
+ dir, Gemma4-26B-A4B (the loaded one). YouTube without subtitles (2:21):
+ tool 32 s. TED with uploader subtitles (20:03): 3.4 s. A 70-minute talk:
+ reported its length, the model asked, called again with `long=1` after
+ "yes" (subtitles, 2.6 s). PeerTube (1:53): subtitles. An Instagram reel
+ (2:54, Italian): whisper, 35 s.
+- **whisper on the CPU is ~0.18x real time on a real talk** (TED as a
+ local AV1/Opus mkv, 218 s for 20:03), not the 0.11x of a short clip:
+ ~11 min an hour, so the 1800 s timeout covers ~2.5 h.
+- Instagram gives no duration (`NA`) without being live: the length is
+ measured on the download, live streams are told by `is_live`.
+- PeerTube writes CRLF subtitles: cue numbers leaked until `\r` was
+ stripped.
+- Segments and cues break mid-sentence: joined into paragraphs ending on
+ a sentence after 400 characters.
+- **turbo repeats words** ("themes themes", "it's it's", often across
+ two segments) and loops over intro music ("Revis Revis ..."); 2670
+ words against the uploader's 3170 on the TED talk. `-mc 0` and `-sns`
+ did not help. Back-to-back repeats are collapsed after the join (a real
+ "very very" goes too). Stray capitals ("It's Been a lot of Fun") stay.
+ Not tried: whisper's `--vad` (silero model, ~1 MB, not downloaded).
+- Stop mid-transcription: whisper gone 0.07 s after the stop, no `.md`,
+ the temp folder left for the next run's day-old sweep.
+- "Summarize it" with no file: it asked for the attachment. With the
+ `.md` attached: a right summary. A transcript that fits the preview is
+ labelled "full text", so the model may answer from it.
+- The daemon already prefixes a tool's stderr with `error: `: a script
+ must not add its own.
+- The model answered an English question in Italian once, after Italian
+ turns in the same chat.
+
### Cloud models, live check (2026-10-23)
Hetzner's inference API (`https://inference.hetzner.com/api/v1`,
diff --git a/docs/superpowers/specs/2026-11-17-video-transcript-design.md b/docs/superpowers/specs/2026-11-17-video-transcript-design.md
index 6422200..3d8b0e3 100644
--- a/docs/superpowers/specs/2026-11-17-video-transcript-design.md
+++ b/docs/superpowers/specs/2026-11-17-video-transcript-design.md
@@ -1,6 +1,6 @@
# Video transcript tool: design
-Date: 2026-11-17. Status: implemented, live check pending.
+Date: 2026-11-17. Status: implemented, live checked 2026-11-17 (AGENTS.md).
## Goal
@@ -94,6 +94,7 @@ description = "1 only after the user agreed to transcribe a video over 30 minute
9700X: a 120 s clip in 13.2 s wall (about 0.11x real time, so ~7 min
for an hour), ~1 GB RSS; a 10 s clip 10.6 s, mostly model load.
8 threads beat 16 (11.98 s on the 10 s clip).
+ On a real talk (20:03, live check) 218 s: ~0.18x, ~11 min an hour.
- Not the daemon's Gemma `input_audio` path: capped at 60 s by the
ubatch, so long audio needs cutting at silences, which can still
drift language between pieces; it needs an audio-capable model
diff --git a/examples/tools/test-video.sh b/examples/tools/test-video.sh
index 55a16d3..cca1aeb 100755
--- a/examples/tools/test-video.sh
+++ b/examples/tools/test-video.sh
@@ -73,6 +73,16 @@ check "own tmp removed" "$(command ls -d "$XDG_RUNTIME_DIR"/video-* | wc -l)" 1
out=$(v "$tmp/Hello Clip.mp4")
contains "collision" "$(head -1 <<<"$out")" "$ASSISTANT_DIR/hello-clip-2.md "
+# Words whisper repeats collapse; a stand-in whisper writes them.
+mkdir -p "$tmp/wbin"
+printf '%s\n' '#!/bin/bash' 'while [ $# -gt 0 ]; do [ "$1" = -of ] && of=$2; shift; done' \
+ "printf ' Revis Revis Revis Good morning.\\n three themes themes, running\\n running through it.\\n' > \"\$of.txt\"" \
+ > "$tmp/wbin/whisper-cli"
+chmod +x "$tmp/wbin/whisper-cli"
+PATH=$tmp/wbin:$PATH v "$tmp/Hello Clip.mp4" >/dev/null
+contains "dedupe" "$(cat "$ASSISTANT_DIR/hello-clip-3.md" 2>/dev/null)" \
+ "Revis Good morning. three themes, running through it."
+
# Refusals: one error line, exit 1, nothing written.
before=$(command ls "$ASSISTANT_DIR" | wc -l)
out=$(v "$tmp/silent.mkv"); check "no audio rc" $? 1
@@ -116,6 +126,7 @@ check "subs no note" "$(grep -c 'comment\|spans' <<<"$md")" 0
sed 's/$/\r/' "$tmp/it.vtt" > "$tmp/crlf.vtt"
out=$(STUB_META=$'125\tFalse\tNA\tCRLF' STUB_VTT="$tmp/crlf.vtt" v "https://example.org/v/9")
md=$(cat "$ASSISTANT_DIR/crlf.md" 2>/dev/null)
+contains "short full" "$out" $'\nfull text:\n'
contains "crlf text" "$md" 'Ciao a tutti & benvenuti Oggi parliamo di Slackware.'
check "crlf no cue ids" "$(grep -c '^[0-9] \| 2 ' <<<"$md")" 0
@@ -143,6 +154,7 @@ contains "no length, long" "$out" "long: Long reel, 31:00."
{ printf 'WEBVTT\n\n'; for i in $(seq 400); do printf '00:00:%02d.000 --> 00:00:%02d.500\nline number %d of the talk.\n\n' $((i % 60)) $((i % 60)) "$i"; done; } > "$tmp/big.vtt"
out=$(STUB_META=$'600\tFalse\ten\tBig Talk' STUB_VTT="$tmp/big.vtt" v "https://example.org/v/6")
contains "big path" "$(head -1 <<<"$out")" "big-talk.md (2400 words"
+contains "big start only" "$out" "start, not the whole text"
check "big under cap" "$(( ${#out} < 2000 ))" 1
para=$(awk 'NR > 5 && NF' "$ASSISTANT_DIR/big-talk.md" | head -1)
check "paragraph joined to a sentence end" "$(( ${#para} > 400 && ${#para} < 440 ))" 1
diff --git a/examples/tools/video.sh b/examples/tools/video.sh
index 1c34593..002c123 100755
--- a/examples/tools/video.sh
+++ b/examples/tools/video.sh
@@ -145,7 +145,12 @@ if [[ -z $text ]]; then
# whisper reads any container through ffmpeg. -ng: CPU, 8 threads beat 16.
whisper-cli -m "$MODEL" -ng -t 8 -l auto -np -otxt -of "$tmp/t" -f "$audio" \
>/dev/null 2>"$tmp/err" || die "whisper: $(tail -1 "$tmp/err")"
- text=$(sed 's/^[[:space:]]*//; /^$/d' "$tmp/t.txt" | paragraphs)
+ # turbo repeats words ("themes themes", "Revis Revis Revis" over music):
+ # a word said twice in a row collapses to one, after the join: a repeat
+ # often straddles two segments.
+ # ponytail: a real "very very" goes too; whisper's --vad may fix the cause.
+ text=$(sed 's/^[[:space:]]*//; /^$/d' "$tmp/t.txt" \
+ | paragraphs | sed -E "s/\b([[:alpha:]']+)([ ,]+\1\b)+/\1/g")
[[ -n $text ]] || die "no speech found"
how="whisper large-v3-turbo"
fi
@@ -166,5 +171,9 @@ mv "$tmp/out.md" "$out" || die "cannot write $out"
words=$(wc -w <<<"$text")
# The path first: the daemon cuts tool output at 2000 characters.
echo "transcript: $out ($words words, $(hms "$dur"), $how)"
-echo "start, not the whole text; to summarize or question it, the user attaches the file:"
+if (( ${#text} <= PREVIEW )); then
+ echo "full text:"
+else
+ echo "start, not the whole text; to summarize or question it, the user attaches the file:"
+fi
printf '%s\n' "${text:0:PREVIEW}"
diff --git a/examples/tools/video.toml b/examples/tools/video.toml
index 450669d..c9c227e 100644
--- a/examples/tools/video.toml
+++ b/examples/tools/video.toml
@@ -1,4 +1,4 @@
-description = "Transcribe the speech in a video, a local file or a public URL (YouTube, social media, web pages). Writes the full transcript to a Markdown file and opens it. Returns the file's path and the start of the text only: you have NOT read the whole transcript, so to summarize or answer questions about it, ask the user to attach the file. Videos over 30 minutes are refused until the user agrees: tell them the length and that it takes a few minutes, then call again with long=1."
+description = "Transcribe the speech in a video, a local file or a public URL (YouTube, social media, web pages). Writes the full transcript to a Markdown file and opens it. Returns the file's path and the start of the text only: you have NOT read the whole transcript. To summarize it or answer questions about it, the user must attach the file: never summarize or answer from the start alone. Videos over 30 minutes are refused until the user agrees: tell them the length and that it takes a few minutes, then call again with long=1."
command = ["video.sh", "{source}", "{long}"]
cloud = ["hetzner"]
timeout = 1800