aboutsummaryrefslogtreecommitdiffstats
path: root/examples/tools/video.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-17 14:36:47 +0100
committerDanilo M. <danix@danix.xyz>2026-11-17 14:36:47 +0100
commit82e74d8eb80ae5778b929e2074d2735d40f710ca (patch)
tree169846de917cfb021c4ee1a1f1278796b9ad3d8a /examples/tools/video.sh
parent27a673d4504b77b47986247cdaf3e3bd41f67c15 (diff)
downloaddesktop-assistant-82e74d8eb80ae5778b929e2074d2735d40f710ca.tar.gz
desktop-assistant-82e74d8eb80ae5778b929e2074d2735d40f710ca.zip
tools: video, collapse whisper's repeated words; live check
whisper turbo repeats words, often across two segments ("it's it's"), and loops over intro music: a word said twice in a row collapses to one, after the segments are joined. A transcript that fits the preview is labelled "full text"; the description forbids summarizing from the start alone. Live check findings in AGENTS.md: 0.18x real time on a real talk, stop kills whisper in 0.07 s, a summary works from the attached file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'examples/tools/video.sh')
-rwxr-xr-xexamples/tools/video.sh13
1 files changed, 11 insertions, 2 deletions
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}"