Create movie file attached subtitles using ffmpeg, mp4, and vtt

I want to see online course’s videos on offline, and switch subtitles on/off.

Table of Contents


In this article, I’m going to describe how to create movie file attached subtitles using ffmpeg, mp4, and vtt. And I’m going to introduce to you the app for playing mkv file.


Required Files

  • movie file(xxx.mp4)
  • vtt file(xxx.vtt)


  • MacOS
  • ffmpeg
    • version 4.2.2
    • You must use latest version
  • VLC Media Player
    • Mac / iPad / Android


Recently, I’ve been learning various tech skill on Coursera, which is an online learning site. In some courses, I can download movie files and subtitles files. I mean, its course materials are possible to use offline and I can learn them anywhere such as commute train.

Further, my course material is English. I want use these material for English learning. And I want switch on/off for subtitles showing.

These official courses have provided only mp4 and vtt file. So if you want the movie file attatched subtitles, you need make it yourself. I would rather use command than install Windows freesoft, so I googled how I can convet these file using command. Finally, my purpose was achieved using by ffmpeg command.

How to

What is “WebVTT”

WebVTT file is a text file that parameter when to show subtitles.

WEBVTT Kind: captions; Language: en

00:09.000 --> 00:11.000
<v Roger Bingham>We are in New York City

00:11.000 --> 00:13.000
<v Roger Bingham>We are in New York City

You can see what the parameter is. (I’ve referenced from Wikipedia)

WebVTT is a file format that is standarded by W3C. You can embed movie contents with subtitles on HTML5.

<video id="video" controls preload="metadata">
   <source src="video/sample.mp4" type="video/mp4">
   <source src="video/sample.webm" type="video/webm">
   <track label="English" kind="subtitles" srclang="en" src="captions/vtt/sample-en.vtt" default>

But I don’t always want to prepare html file as above. So it is neccessary to create movie file embeded subtities beforehand.

“ffmpeg” is the commandline tool when we embed subititles to movie file.

What is “ffmpeg”

ffmpeg is a free software that is used for recording, converting, and playing sounds and movies. This tool is enable for us to convert various file encoding from commandline.

If you use MacOS, you can install it from Homebrew.

$ brew install ffmpeg

Embeded subtitles to movie file using ffmpeg

Finally, we have only toembed subtitles to movie file as mkv using ffmpeg.

ffmpeg -i [original_movie_name].mp4 -i [vtt_filename].vtt \
  -map 0:v -map 0:a -map 1 \
  -metadata:s:s:0 language=[eng(If you use English) / jpn(If you use Japanese)] \
  -c:v copy -c:a copy -c:s srt \

Seeing mkv file

At last, we can get a movie file attached subtitles. But Windows and Mac are impossible to mkv file format on default. So you will have to install some movie players.

I recommend the VLC Medeia Player. Originally a French students have invented this software, now it becomes one of the most famous player that can convert various codec.


I’ve introduced how to create movie file attached subtitles using ffmpeg, mp4, and vtt. Although this Know-how is used for very niche condition, I had hard time finding these technique, so I’ve put it on my blog.

Game Programmer
Build Engineer

I’m a Game Programmer. In my work, I often use Unity3D Engine with C#/C++ to develop game app.