Extract Video Chapters to Text with FFmpeg

Extracting chapter information from a video file is an efficient way to manage media metadata, document video structures, or prepare assets for editing. This guide provides a straightforward, step-by-step walkthrough on how to use the command-line tool FFmpeg to extract embedded chapters from a video file (such as MP4, MKV, or MOV) and save them directly into a standardized metadata text file.

Step 1: The Extraction Command

To extract chapters and other metadata from a video file, you need to use FFmpeg’s metadata muxer. Open your command line interface (Terminal on macOS/Linux or Command Prompt/PowerShell on Windows) and run the following command:

ffmpeg -i input.mp4 -f ffmetadata metadata.txt

Step 2: Understanding the Command Arguments

Step 3: Analyzing the Output File

Once the command finishes executing, a new text file named metadata.txt will appear in your working directory. When you open this file in a text editor, you will see global metadata at the top, followed by specific blocks for each chapter.

The chapter blocks will look similar to this:

[CHAPTER]
TIMEBASE=1/1000
START=0
END=30000
title=Introduction

[CHAPTER]
TIMEBASE=1/1000
START=30000
END=120000
title=Chapter 1: Getting Started

Key Chapter Metadata Fields

This generated text file can now be edited, stored as a backup, or imported into another video file using FFmpeg.