From 82e74d8eb80ae5778b929e2074d2735d40f710ca Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 17 Nov 2026 14:36:47 +0100 Subject: 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 --- examples/tools/video.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'examples/tools/video.sh') 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}" -- cgit v1.2.3