Dev.to WebDev 🛠 Dev 👁 0 📖 5 min read

Add Chapters to a Product Video: YouTube, WebVTT and MP4

To add chapters to a product video, write one list of start times and titles, then publish it three ways: as timestamps in the YouTube description, as a WebVTT chapters track for the copy on your own site, and as chapter

To add chapters to a product video, write one list of start times and titles, then publish it three ways: as timestamps in the YouTube description, as a WebVTT chapters track for the copy on your own site, and as chapter metadata inside the MP4 file. Same list, three formats. It takes about twenty minutes once you have the times.

I care about this because a three minute walkthrough is really five short answers glued together. Chapters let a viewer skip to the one they came for instead of scrubbing.

Contents

  • Why do chapters matter in a product video?
  • How do you write the chapter list once?
  • How do YouTube chapters work?
  • How do you add chapters to a video on your own site?
  • How do you put chapters inside the MP4 file?
  • Key takeaways
  • FAQ

Why do chapters matter in a product video?

People rarely watch a walkthrough start to finish. They come with one question: how do I invite my team, where is the export, what does the report look like. If the answer starts at 2:10 and nothing tells them that, they leave at 0:40.

Chapters also force a useful discipline on the video itself. If you can't name a section in four or five words, the section probably does two jobs and should be split.

How do you write the chapter list once?

Keep a plain text file next to the video. Start times in mm:ss, then a short title:

00:00 What the app does
00:18 Connect your data
00:52 Build the first report
01:40 Share it with your team
02:25 Export and schedule

A few rules I follow for the titles:

  • Name the task, not the screen. "Share it with your team" beats "Settings page".
  • Keep each one under about 30 characters so it fits on a phone.
  • Start each chapter where the voiceover starts a new idea, and line that up with a real cut.

Everything below is generated from this file, so there is one place to fix a typo.

How do YouTube chapters work?

YouTube reads chapters straight from the video description. There is no separate field. The list has to meet a few rules or YouTube ignores it:

Rule What it means in practice
First timestamp is 0:00 Your first line must start at zero
At least three timestamps Two chapters won't show
Each chapter at least 10 seconds Merge very short steps
Times in ascending order Sort before you paste

Paste the list as is. YouTube also has an automatic chapters setting, but for a product video I'd rather choose the names myself, since they double as a short outline of the product. Our post on YouTube SEO for product demo videos covers the rest of the description.

How do you add chapters to a video on your own site?

Turn the list into a WebVTT file with kind="chapters". Each cue needs an end time, which is simply the next chapter's start:

WEBVTT

1
00:00:00.000 --> 00:00:18.000
What the app does

2
00:00:18.000 --> 00:00:52.000
Connect your data

Attach it to the video:

<video id="demo" controls preload="none" src="/video/walkthrough.mp4">
  <track kind="chapters" src="/video/walkthrough.chapters.vtt" srclang="en" default>
  <track kind="captions" src="/video/walkthrough.en.vtt" srclang="en" label="English">
</video>
<ol id="chapters"></ol>

Most browsers load a chapters track but don't draw a chapter menu for it. So build a small one yourself:

const video = document.getElementById('demo');
const track = [...video.textTracks].find((t) => t.kind === 'chapters');
track.mode = 'hidden'; // load cues without displaying them

video.querySelector('track[kind="chapters"]').addEventListener('load', () => {
  const list = document.getElementById('chapters');
  for (const cue of track.cues) {
    const li = document.createElement('li');
    const btn = document.createElement('button');
    btn.textContent = cue.text;
    btn.addEventListener('click', () => { video.currentTime = cue.startTime; video.play(); });
    li.append(btn);
    list.append(li);
  }
});

Use real buttons so the menu works with a keyboard. If the page also has captions, keep them in a separate track. Captions and chapters are different kinds of text and mixing them confuses screen readers. If you make captions from your script, our guide to SRT and VTT subtitle files explains which format goes where.

How do you put chapters inside the MP4 file?

Some people download the file, or you send it to a customer directly. MP4 can carry chapter markers that players like VLC and QuickTime show. ffmpeg writes them from a metadata file:

;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=0
END=18000
title=What the app does

[CHAPTER]
TIMEBASE=1/1000
START=18000
END=52000
title=Connect your data
ffmpeg -i walkthrough.mp4 -i chapters.txt \
  -map_metadata 1 -map_chapters 1 -codec copy walkthrough-chapters.mp4
ffprobe -v error -show_chapters walkthrough-chapters.mp4

The -codec copy means no re-encode, so it runs in seconds and quality doesn't change. The ffprobe line prints the chapters back so you can check them.

A small script that reads the text list and writes the description block, the VTT file and the metadata file is worth the half hour. I build DemoVexa, which makes narrated demo videos from a local codebase and exports captions as SRT or VTT, and chapters are the kind of thing I script around the export rather than redo by hand.

Key takeaways

  • Keep one chapter list file and generate every format from it.
  • YouTube needs 0:00 first, three or more chapters, each at least 10 seconds.
  • On your own site, use a kind="chapters" WebVTT track and build the menu with buttons.
  • Write MP4 chapters with ffmpeg metadata and -codec copy, then check with ffprobe.
  • If you can't name a section in a few words, split it.

FAQ

How many chapters should a product video have?

One per task the viewer might come looking for. For a two to four minute walkthrough that is usually four to seven.

Why aren't my YouTube chapters showing?

Usually the first timestamp isn't 0:00, there are fewer than three, or one chapter is under 10 seconds. Fix the list and save the description again.

Do browsers show WebVTT chapters on their own?

Mostly not. They parse the track, but you need a little JavaScript to show a clickable list.

Do MP4 chapters survive uploading to YouTube?

Don't count on it. Put the timestamps in the description as well.

I'm Baltej Singh, founder of DemoVexa, a desktop app and CLI that turns a local codebase into narrated product demo videos. I write from Delaware, USA.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.