
A subtitle cue is one text block with a display start and end time. SRT (SubRip Text) uses commas before milliseconds. VTT (WebVTT) starts with a `WEBVTT` header and uses periods before milliseconds. UTF-8 is a standard text encoding that keeps special characters intact. An Actor is a program that collects web data, and a Task is a saved input setting for an Actor.
To extract captions, use the YouTube Transcript Scraper Actor. Request JSON along with SRT and VTT formats. The raw JSON output includes specific segment fields: `startSeconds`, `endSeconds`, `durationSeconds`, and `text`. Save the raw subtitle string alone as a UTF-8 text file. Do not export the whole dataset as CSV or keep escaped JSON strings with `\n` characters. Failed inputs appear in the run OUTPUT rather than dataset rows. A test run on one track saved 61 cues to validate acquisition, but you must still check playback in your own player.
If timed captions are missing entirely, review the YouTube caption extraction guide before validating your files.
Complete Method for Conversion and Validation
- Confirm video identity and language: Check the video URL and selected language. Keep the original JSON cues and source URL.
- Request outputs: Request JSON, SRT, and VTT formats. Check for a successful row and non-empty segments. If captions fail, use the linked acquisition guide. Do not invent end times from plain text.
- Save the file: Copy the full `srt` field into `lesson.srt` or the `vtt` field into `lesson.vtt`. Use a plain text editor with UTF-8 encoding. Do not keep JSON quotes, literal `\n` characters, CSV cells, or a `.txt` extension appended to the filename.
- Check syntax: SRT uses cue numbers and commas before milliseconds. VTT starts with `WEBVTT`, a blank line, and uses periods before milliseconds. Both formats separate cues with blank lines and use `-->` between times. Confirm that end times are after start times and check that cue start times do not decrease. Overlaps can be valid; inspect them in playback instead of deleting them automatically.
- Check video playback: Compare the first, middle, and last cues against your video player. Check accents, line breaks, and long lines. A file can pass formatting checks but still show wrong timing or text on screen.
- Fix timing offsets: If every cue is late by the same fixed time, check if your local video copy removed an intro. Shift both start and end times by that exact offset only for that specific copy. If the timing error grows larger over time, a fixed shift will not work. When timing drift grows, return to the correct timed source instead of applying an untested frame-rate conversion.
- Save final files: Save your source cues and a note of any approved time changes.
Fictional Example Files
Here is a simple example using three cues measured in seconds:
- Cue 1: `0.250` to `2.750` seconds — “Open the settings.”
- Cue 2: `3.000` to `5.500` seconds — “Choose Français.”
- Cue 3: `6.000` to `8.125` seconds — “Save the change.”
Complete SRT File
1
00:00:00,250 --> 00:00:02,750
Open the settings.
2
00:00:03,000 --> 00:00:05,500
Choose Français.
3
00:00:06,000 --> 00:00:08,125
Save the change.Complete VTT File
WEBVTT
00:00:00.250 --> 00:00:02.750
Open the settings.
00:00:03.000 --> 00:00:05.500
Choose Français.
00:00:06.000 --> 00:00:08.125
Save the change.Notice that SRT uses commas (`00:00:00,250`) while VTT uses periods (`00:00:00.250`) for every millisecond delimiter.
Math Breakdown
To convert fractional seconds to milliseconds, multiply by 1,000. For example, `0.250` seconds becomes `250` milliseconds, and `8.125` seconds becomes `00:00:08.125`.
- The cue durations are 2.500 seconds, 2.500 seconds, and 2.125 seconds.
- The total active cue duration is 7.125 seconds (`2.500 + 2.500 + 2.125`).
- The total subtitle span is 7.875 seconds (`8.125 - 0.250`), which includes the spaces between cues.
Neither sum measures text accuracy or reading speed.
Separate Timing Offset Example
Imagine a second, separate video copy that has a 1.000-second intro removed. A cue pair in that video originally timed at `10.250–12.750` seconds becomes `9.250–11.750` seconds after subtracting 1.000 second (`10.250 - 1 = 9.250` and `12.750 - 1 = 11.750`).
Never apply this shift to the first three-cue example file. Subtracting 1.000 second from the first cue (`0.250`) would create an invalid negative start time (`-0.750`). Keep original files unchanged and check shifted files in a video player before use.
Sources & further reading
By Chronometrica · Updated
Back to top ↑

