YouTube chapters not showing? Check AI timestamps with a script
Pasted AI-made chapters and none show? Give the AI the video length and rules, then script-check the 00:00 start, 10-second minimum and real transcript times.
You pasted timestamps into the description, saved, and no chapters appear under the video. Check the rules first. YouTube's help page says manual chapters need the first timestamp to be 00:00, at least three timestamps in ascending order, and a minimum chapter length of 10 seconds (YouTube Help). Check whether the AI's list keeps them.
The transcript and a short request
The transcript is for a fictional how-to video (8 min 12 s). The [mm:ss] before each line is when the sentence starts; the first line is at 00:02, and the 03:41 line is 6 seconds long on purpose.
[00:02] Hi, today I'll show you how to set up the SoilBuddy plant moisture sensor for the first time.[00:15] We'll go in order, from charging to pairing with the app to setting an alert, all in this one video.[00:31] First, what's in the box: the sensor, a charging cable, and two stakes for holding it in place.[00:47] The manual is just one QR code, so this video is the faster way.[00:58] Before use, charge the sensor. Open the cover on the bottom of the body and you'll see the USB-C port.[01:22] Charging takes about two hours, and the light turns green when it's done.[01:40] While it charges, download the app to save time.[01:50] The app is called SoilBuddy and you can find it in any app store.[02:10] Create an account and allow Bluetooth and location permissions. Without them the sensor won't show up.[02:38] Now pair the sensor. Hold the button on the body for three seconds and a blue light starts blinking.[03:05] When you pick a Wi-Fi network, only the 2.4 GHz band can be selected. 5 GHz networks don't appear in the list.[03:34] When pairing finishes, the sensor's name appears in the app.[03:41] By the way, the stakes are sold separately in a 6-pack, and the link is in the description.[03:47] Now let's put it in the pot. The metal part of the sensor has to go all the way into the soil, about five centimeters.[04:20] Don't push it into the roots; place it toward the edge of the pot.[04:52] On the app screen you'll see soil moisture as a percentage.[05:25] The numbers are simple. Below 30 percent is dry soil, and above 60 percent is well watered.[05:58] Next is alert settings. In the settings menu you choose the alert threshold. I set mine to 25 percent.[06:31] When that's done, press the test alert button to check that a notification reaches your phone.[06:58] Finally, troubleshooting. If it won't connect, first check that your Wi-Fi is 2.4 GHz.[07:25] If the reading stays at 0, wipe the soil off the metal part of the sensor and that usually fixes it.[07:48] To recap: charge it, pair it in the app, put it in the soil, and set the alert threshold. That's it.[08:05] If this helped, please subscribe. Thanks for watching."Make YouTube chapter timestamps from this transcript." went in front, in three English runs and three Korean runs (the Korean ones used a Korean transcript).
All 6 gave 10 chapters and passed the check script below: the first was 00:00, 03:41 was not used, and the last chapter started at 07:48. But each list came wrapped in an intro sentence and a code fence (once with a summary list added), and in 2 of the 3 English runs a - sat between the time and the title. To paste it into a description, you have to pick the list out by hand.
Ask for finer chapters
Adding "Split it finely, at least 12 chapters." changed things.
The 6 runs (3 English, 3 Korean) gave 17 to 21 chapters, and in all 6 the last chapter was 08:05. The video ends at 08:12, so that chapter is 7 seconds long, under the 10-second minimum. In one Korean run 03:41 was also a chapter, another 6-second one. This request did not give the video length, and the transcript alone cannot show it ends at 08:12, so the AI is not entirely at fault. The next prompt includes the length.
A prompt with the rules and the video length
Google's prompting strategies tell you to specify any constraints on the response. Here that means writing YouTube's rules into the prompt. Times may only be copied from the transcript, so the AI never has to do time arithmetic.
Below, <transcript> is the transcript of a video that is {video length} (mm:ss) long. The [mm:ss] at the start of each line is when that sentence begins. Make the chapter list to paste into the YouTube description. Rules:- One chapter per line in the form `mm:ss Title`. Output only the chapter list and nothing else.- The first chapter must start at 00:00, even though the first transcript line is at 00:02.- Every other chapter time must be one of the [mm:ss] values in the transcript, copied as is. Do not calculate or invent times.- {min} to {max} chapters, times in ascending order, each chapter at least 10 seconds long (next chapter's start − this chapter's start ≥ 10 seconds; the last chapter runs to the end of the video at {video length}).- Titles are at most 40 characters and describe what is actually said in that part. <transcript>{transcript}</transcript>In the prompt actually sent, the length was 8 minutes 12 seconds (08:12) and the count was 5 to 9, then 12 to 14 in a second round.
$ agy -p "$(cat rules12.en.txt)" --model gemini-3.8-flash --effort high --output-format text > out.rules12.en.1.txt$ tail -2 out.rules12.en.1.txt06:58 Troubleshooting07:48 RecapNo line starting with 08:05 appeared in any of these 6 runs. Length and rules were added together, so which one did the work was not separated.
Check with a script
It checks five things at once: the first chapter is 00:00, there are at least 3, they ascend, each is at least 10 seconds (the last one up to the video length), and every time except the first appears in the transcript. It reads only the chapter lines, so code fences and - do no harm.
#!/usr/bin/env python3"""usage: check_chapters.py transcript.txt out.txt VIDEO_LENGTHVIDEO_LENGTH is mm:ss. Checks YouTube's chapter rules plus "every time comes from the transcript"."""import re, syssys.stdout.reconfigure(encoding="utf-8") def secs(t): m, s = t.split(":") return int(m) * 60 + int(s) if int(s) < 60 else None # 01:98 is not a time transcript = open(sys.argv[1], encoding="utf-8").read()have = {secs(t) for t in re.findall(r"^\[(\d{1,2}:\d{2})\]", transcript, re.M)} - {None}length = secs(sys.argv[3])if not have: print("FAIL no [mm:ss] lines in transcript"); sys.exit(2) chap = []for line in open(sys.argv[2], encoding="utf-8").read().splitlines(): m = re.match(r"^\s*(?:[-*]\s+)?(\d{1,2}:\d{2})\s+(\S.*)$", line) if m: chap.append((m.group(1), secs(m.group(1)), m.group(2).strip())) bad = 0for txt, s, title in chap: if s is None: print(f"FAIL {txt} {title} <- seconds must be below 60"); bad += 1if bad: print(f"{len(chap)} chapters, {bad} problems"); sys.exit(1)def fail(msg): global bad print("FAIL", msg); bad += 1 if not chap: fail("no chapter lines found")else: if chap[0][1] != 0 or chap[0][0] != "00:00": fail(f"first chapter is {chap[0][0]}, must be 00:00") if len(chap) < 3: fail(f"only {len(chap)} chapters, need at least 3") for i, (txt, s, title) in enumerate(chap): end = chap[i + 1][1] if i + 1 < len(chap) else length msgs = [] if i and s <= chap[i - 1][1]: msgs.append("not ascending") if s >= length: msgs.append("starts at or after video end") if end - s < 10: msgs.append(f"only {end - s}s long") if s != 0 and s not in have: msgs.append("time not in transcript") print(("FAIL " if msgs else "ok ") + f"{txt} {title}" + (" <- " + ", ".join(msgs) if msgs else "")) bad += bool(msgs)print(f"{len(chap)} chapters, {bad} problems")sys.exit(1 if bad else 0)$ python3 -I check_chapters.py transcript.en.txt out.short12.en.1.txt 08:12 | grep -E "FAIL|chapters"FAIL 08:05 Outro & Wrap Up <- only 7s long18 chapters, 1 problems$ python3 -I check_chapters.py transcript.en.txt out.rules12.en.1.txt 08:12 | tail -2; echo "exit ${PIPESTATUS[0]}"ok 07:48 Recap13 chapters, 0 problemsexit 0| Prompt | Chapters | Passed the check |
|---|---|---|
| Short request | 10 (all 6 runs) | 6/6 (but not clean to paste) |
| Short request + "at least 12" | 17 to 21 | 0/6 (08:05 in all 6, 03:41 too in one) |
| Rules + length, 5 to 9 | 9 (all 6 runs) | 6/6 |
| Rules + length, 12 to 14 | 13 to 14 | 6/6 |
Testing the checker
Thirteen broken inputs were made by hand from the second English output of the "rules + 5 to 9" prompt, one change each (first line 00:02 or 0:00, a time not in the transcript, 01:98, a 6-second or 7-second chapter, only two lines, swapped order, an empty file and so on). Only the - separator input, which should pass, exited 0; the other 12 exited 1 (these are not model outputs). One example, a 03:41 chapter added before 03:47:
$ python3 -I check_chapters.py transcript.en.txt badEn/insert6.txt 08:12 | grep FAILFAIL 03:41 Stake accessories <- only 6s long0:00 is rejected on purpose to match YouTube's 00:00; whether it works was not tested. The first version compared times only as seconds, so 01:98 passed as 02:38 (cross-review finding); now seconds of 60 or more fail. The same changes to the Korean output gave the same results. The other inputs are in run/badEn/.
Where it still goes wrong
- The last title does not cover its span. With the rules prompt for 5 to 9 chapters, 4 of 6 runs ended with
06:58 Troubleshooting. That chapter runs to 08:12, so it also holds the recap at07:48and the sign-off at08:05. The script passes it. Read the last title yourself. - It checks times only. A chapter time passes if it is in the transcript, whichever sentence it is. Whether the chapter breaks where the topic changes is something to read against the transcript.
- The transcript times have to be right. If auto-caption times drift, everything drifts and still passes. Play one or two chapters.
- When not to trust it. Videos over an hour need
h:mm:ss, and the script reads onlymm:ss. Other reasons chapters may not appear are outside this post.