GrepBoard/Manuals
605 manuals ·

Summarize a lecture transcript with timestamps for review

·Tested on Gemini 3.8 Flash · 2026-10·Test scope ↓·6 steps

Extract timestamps and verbatim quotes from lecture SRT files into a review table. Verify all timestamps and quoted lines against raw subtitles using Python.

When attempting to extract review summaries with timestamps from lecture SRT files, standard prompts frequently invent non-existent timestamps or scramble chronological order. The principle of grounding summaries in verbatim quotes mirrors the approach in Claude Summary with Quotes.

To prevent timestamp hallucinations, force the model to copy the exact cue start time (HH:MM:SS) from the subtitles and extract a single verbatim sentence spoken at that precise moment.

[1] Prepare the lecture subtitles (SRT). The following sample is an introductory lecture on data visualization with 20 cues (00:00:10 to 00:12:58).

lecture.en.srt
100:00:10,000 --> 00:00:18,500Welcome to lecture four on data visualization fundamentals. Today we cover design principles that avoid distorting information. 200:00:19,200 --> 00:00:27,800The most common mistake in practice is truncating the Y-axis instead of starting it at zero.…500:02:25,000 --> 00:02:33,000Our second topic covers choosing the right chart type based on data structure.…900:05:50,000 --> 00:05:58,500The third topic addresses cognitive weaknesses associated with pie charts.…1300:09:15,000 --> 00:09:23,500Fourth is purposeful color design to reduce extraneous cognitive load.…1700:12:20,000 --> 00:12:29,000Finally, our fifth section explores Edward Tufte's principle of the data-ink ratio.…2000:12:49,500 --> 00:12:58,000Removing superfluous ink allows the inherent shape and pattern of the data to shine through clearly.

[2] Construct the prompt. Extracting verbatim quotes prior to synthesis reduces hallucinations as outlined in Anthropic's guardrail guide, while injecting raw subtitle files directly into the prompt pins down context per Google's prompting strategies guide.

prompt_en.txt
Analyze the provided lecture subtitles (SRT) and create a review summary table with timestamps. Rules:1. Divide the lecture into key topic sections based on the subtitles.2. For each section, provide: Start Timestamp (HH:MM:SS), Topic, Core Summary (1-2 sentences), and Verbatim Quote (exactly 1 key sentence from the subtitles at that timestamp).3. The Start Timestamp must be copied exactly from the start time of the corresponding subtitle cue (HH:MM:SS format). Do not estimate, invent, or round timestamps.4. The Verbatim Quote must be copied word-for-word from the subtitle text at that timestamp.5. Do not include external facts or assumptions not present in the subtitles.6. Output only the Markdown table without any introductory or concluding remarks. Table Header:| Timestamp | Topic | Core Summary | Verbatim Quote | <subtitles>{SRT_CONTENT}</subtitles>

[3] Execute Gemini using the agy CLI.

console
$ agy -p "$(cat run/en1.prompt.txt)" --model gemini-3.8-flash --effort high --output-format text > run/en1.out.txt$ cat run/en1.out.txt| Timestamp | Topic | Core Summary | Verbatim Quote || --- | --- | --- | --- || 00:00:10 | Avoiding Information Distortion and Y-Axis Truncation | Truncating the Y-axis instead of starting it at zero distorts information by making minor differences appear massive. Because bar charts encode quantitative values using bar length, their baseline must always begin at zero. | Today we cover design principles that avoid distorting information. || 00:02:25 | Choosing Chart Types Based on Data Structure | Bar charts are the most reliable choice for discrete category comparisons, whereas line charts should be used to trace continuous trends over time. Applying line charts to categorical data artificially implies continuity between unrelated items. | Our second topic covers choosing the right chart type based on data structure. || 00:05:50 | Cognitive Weaknesses of Pie Charts | Human visual perception struggles to accurately judge minor differences in angles and surface areas. When dealing with similar values or more than five slices, pie charts should be replaced with sorted horizontal or stacked bar charts. | The third topic addresses cognitive weaknesses associated with pie charts. || 00:09:15 | Purposeful Color Design | Assigning distinct rainbow colors across bars creates visual noise and extraneous cognitive load. Designers should keep baseline elements in neutral grays and reserve a single accent color so the primary takeaway stands out immediately. | Fourth is purposeful color design to reduce extraneous cognitive load. || 00:12:20 | Edward Tufte's Data-Ink Ratio | The data-ink ratio compares the proportion of ink used for actual data against total ink. Removing chartjunk such as heavy grid lines, dark backgrounds, and 3D effects allows the inherent patterns of the data to shine through clearly. | Finally, our fifth section explores Edward Tufte's principle of the data-ink ratio. |

A second run with identical input (en2.out.txt) yielded the exact same five start timestamps (00:00:10, 00:02:25, 00:05:50, 00:09:15, 00:12:20) and quotes, varying only slightly in summary phrasing.

[4] Build a verification script to audit timestamps and quotes against the original SRT. For every row of the table it checks that the start time equals the start (to the second) of some cue, that rows are in time order, and that the quote appears in the text of a cue starting in that second. If more than one cue starts in the same second, all of them count as candidates. It cannot judge whether the summary column is correct or whether that time is a sensible start for the section.

run/check_timestamps.py
#!/usr/bin/env python3"""usage: check_timestamps.py <srt_file> <table_output_file> [ko|en]Checks each table row: the start time (HH:MM:SS) is the start of some cue, rows are in time order,and the quote is a substring of a cue that starts in that second."""import re, sys MSG = {    "ko": ("존재하지 않는 시각", "순서 오류", "해당 큐 일치", "자막 내 존재하나 시각 불일치", "자막 전체에 문장 없음", "행", "총 {n}행 검사: 오류 {e}건"),    "en": ("no cue starts at this time", "out of order", "quote found in a cue at this time", "quote exists in the subtitles but at another time", "quote not found in the subtitles", "row", "{n} rows checked: {e} error(s)"),} def parse_srt(path):    cues = []    for b in re.split(r"\n\s*\n", open(path, encoding="utf-8").read().strip()):        lines = [l.strip() for l in b.splitlines() if l.strip()]        if len(lines) >= 3 and "-->" in lines[1]:            m = re.search(r"(\d{2}:\d{2}:\d{2})", lines[1])            if m:                cues.append((m.group(1), " ".join(" ".join(lines[2:]).split())))    return cues def to_sec(ts):    p = [int(x) for x in ts.split(":")]    return p[0] * 3600 + p[1] * 60 + p[2] if len(sys.argv) < 3:    sys.exit(__doc__)srt_path, out_path = sys.argv[1], sys.argv[2]t = MSG[sys.argv[3] if len(sys.argv) > 3 else "en"]cues = parse_srt(srt_path)srt_times = {}for ts, text in cues:                      # several cues may start in the same second    srt_times.setdefault(ts, []).append(text)full_text = " ".join(c[1] for c in cues) rows = [l.strip() for l in open(out_path, encoding="utf-8").read().splitlines() if l.strip().startswith("|")]data = [[c.strip() for c in r.strip("|").split("|")] for r in rows]data = [r for r in data if len(r) >= 4 and not re.match(r"^:?-+:?$", r[0])][1:] errors, seen, prev_sec = 0, set(), -1for idx, (raw_time, topic, summary, quote, *_) in enumerate(data, 1):    m = re.search(r"\b(\d{2}:\d{2}:\d{2})\b", raw_time)    ts = m.group(1) if m else ""    sec = to_sec(ts) if ts else -1    q = " ".join(quote.strip('"\'`').split())     if not ts or ts not in srt_times:        flag, err = "FAIL", t[0]; errors += 1    elif ts in seen or sec <= prev_sec:        flag, err = "FAIL", t[1]; errors += 1    elif q and any(q in c for c in srt_times[ts]):        flag, err = "OK  ", t[2]    elif q and q in full_text:        flag, err = "FAIL", t[3]; errors += 1    else:        flag, err = "FAIL", t[4]; errors += 1     seen.add(ts)    prev_sec = sec    print(f"[{flag}] {t[5]} {idx}: {ts} | {err}") if not data:    print("no table rows found"); errors += 1print(t[6].format(n=len(data), e=errors))sys.exit(1 if errors else 0)

[5] Run the verification script against the model output.

console
$ python3 run/check_timestamps.py run/lecture.en.srt run/en1.out.txt en[OK  ] row 1: 00:00:10 | quote found in a cue at this time[OK  ] row 2: 00:02:25 | quote found in a cue at this time[OK  ] row 3: 00:05:50 | quote found in a cue at this time[OK  ] row 4: 00:09:15 | quote found in a cue at this time[OK  ] row 5: 00:12:20 | quote found in a cue at this time5 rows checked: 0 error(s)

The second run (en2.out.txt) gave the same result (2 of 2 passed). The gaps in the checker were tested with hand-made input (not model output). out_bad_en.txt has the timestamp changed to the non-existent 00:03:00 and one quote altered; one missing timestamp and one quote mismatch were both flagged. In the Korean lecture_samesec.srt, where two cues start in the same second (00:00:10), a row quoting the first cue exactly passed.

console
$ python3 run/check_timestamps.py run/lecture.en.srt run/out_bad_en.txt en[OK  ] row 1: 00:00:10 | quote found in a cue at this time[FAIL] row 2: 00:03:00 | no cue starts at this time[FAIL] row 3: 00:05:50 | quote not found in the subtitles[OK  ] row 4: 00:09:15 | quote found in a cue at this time[OK  ] row 5: 00:12:20 | quote found in a cue at this time5 rows checked: 2 error(s)

[6] Observed weaknesses and prompt adjustments.

In all 20 table rows from the 2 Korean and 2 English runs, the quote was the opening sentence of the cue where the section starts ("Today we cover...", "Our second topic covers..."), and all 4 runs gave the same 5 timestamps and the same 5 quotes. To quote a rule inside the section (such as the Y-axis rule) instead, specify the range in the prompt. This adjustment was not tested in this run.

  • Adjustment line: "For the verbatim quote, extract one representative sentence containing the core conclusion or rule of that section, and record its specific start timestamp."

Do not rely on this method when the subtitles contain heavy speech-recognition (ASR) errors. If technical terms or numbers were transcribed incorrectly, the summary table will carry those errors.

#lecture-summary#srt#timestamps#gemini