Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Add Chapters To MKV File

Chapters allow you to skip to key points in a video. This is particularly useful if you are watching a recording of a meeting/conference and want to skip the introductions etc. This tutorial will show you how to easily add chapters to a MKV file using the mkvmerge tool on Ubuntu 16.04.


Firstly, install the mkvmerge command by installing the mkvtoolnix package.

sudo apt-get install mkvtoolnix -y

Now use your text editor of choice to create a simple text file using the "simple chapter format" as shown below (self-explanatory):

CHAPTER02NAME=Baby prepares to rock
CHAPTER03NAME=Baby rocks the house

Now use mkvmerge to add that to your mkv file (this will remove any existing chapters in the file).

mkvmerge \
  --chapters chapters.txt \
  -o output.mkv \

Wait for the processing to complete (shou'dn't take long), and now you will be able to use your video-player's buttons to skip between chapters.

MPV player helpfully shows the chapter names on screen when you do this:


Last updated: 6th May 2019
First published: 16th August 2018