Jeremy Richard moving pictures editor Est. 2008

Video filter subtitles

using ffmpeg 3

The free and libre command line tool ffmpeg, in addition to encode videos, can also “draw” subtitles onto a video. Using ffmpeg we can enable filters that allow us to manipulate the video we are working on. One of these filter/manipulation is to basically print/incrust/draw texts onto a video.

For the following explanation I will assume that we have:

As a remark, I will add that applying filters with ffmpeg, such as this subtitle filter, means re-encoding the video with the subtitles. So, even if we can go from the mov format to a mov format, for example, ffmpeg will still re-encode the video while adding the subtitles on top of the image. If we wish our video with the burnt subtitles to be the master file, then adding the subtitles from the editing software might a more adequate solution.

Let us begin.

A video demonstration

The command

The basic command to burn the subtitles (subtitles.srt) onto a video (input.mov) is the following: ffmpeg -i input.mov -vf subtitles=input.srt output.mp4

What matters here is -vf subtitles=input.srt

As for:

An example

So now in practical terms:

  1. open the terminal/console;
  2. go to the folder where the files are located using the cd command: cd "C:\Path to\Your folder".4 This is for comfort as so we won’t have to put the full path of the file each time we need it.5
  3. enter the following command: ffmpeg -i input.mov -vf subtitles=input.srt output.mp4
  4. the progression of our burning will then appear, showing something like this: frame= 738 fps= 86 q=26.0 size= 1536kB time=00:01:01.25 bitrate= 205.4kbits/s speed=7.13x, and will eventually disappear, indicating to us that the burning is done.
  5. so we can now found the final video output (output.mp4) in the folder in which we pointed the terminal (using the cd command). Once we play it we’ll see subtitles onto the video.

The End