---
title: 'Subtitles & FFMPEG: How To Caption Your Video The FFmpeg Way'
source: 'https://youtube.com/watch?v=bjhN2mjQ_X8'
video_id: 'bjhN2mjQ_X8'
date: 2026-07-28
duration_sec: 1765
---

# Subtitles & FFMPEG: How To Caption Your Video The FFmpeg Way

> Source: [Subtitles & FFMPEG: How To Caption Your Video The FFmpeg Way](https://youtube.com/watch?v=bjhN2mjQ_X8)

## Summary

This video tutorial demonstrates how to manage subtitles using FFmpeg, covering extraction, conversion, embedding, and hard-burning subtitles into video files. The presenter uses the open movie Sintel as an example to show practical commands for handling subtitle tracks.

### Key Points

- **Inspecting video streams with FFprobe** [01:37] — Use 'ffprobe' to list all tracks in a video, including subtitle streams. The command 'ffprobe -show_streams -show_format' reveals codec types and stream indices.
- **Listing available subtitle codecs** [03:13] — Run 'ffmpeg -codecs | grep subtitle' to see all supported subtitle codecs. Subrip (SRT) is a common format.
- **Extracting subtitles from a video** [05:08] — Use 'ffmpeg -i input.mp4 -vn -an -map 0:s:0 -c copy output.srt' to extract the first subtitle track without re-encoding.
- **SRT subtitle file format** [07:05] — SRT files are plain text with sequential numbers, timecodes (start --> end), and subtitle text. Entries are separated by blank lines.
- **Converting subtitles to different formats** [09:21] — Change the output extension to convert formats, e.g., 'output.ass' for ASS subtitles. The syntax differs: ASS uses a CSV-like structure with formatting codes.
- **Extracting multiple subtitle languages** [10:43] — Use 'ffprobe' to find stream indices for each language. Then extract each with 'ffmpeg -i input -vn -an -map 0:s:index -c copy lang.srt'.
- **Creating a video with multiple subtitle tracks** [14:42] — Combine video, audio, and subtitle files using 'ffmpeg -i video -i sub1 -i sub2 -map 0:v -map 0:a -map 1 -map 2 -c copy output.mkv'.
- **Setting language metadata for subtitle tracks** [18:49] — Use '-metadata:s:s:0 language=eng' and '-metadata:s:s:1 language=ita' to label subtitle streams. Verify with 'ffprobe'.
- **Hard-burning subtitles into the video** [24:30] — Apply the subtitles filter: 'ffmpeg -i input -vf "subtitles=subs.srt" -c:v libx264 -crf 0 -preset slow -c:a copy output.mkv'. This re-encodes the video.

### Conclusion

FFmpeg provides powerful tools for subtitle management, from extraction and conversion to embedding and hard-burning. Mastering these commands enables precise control over subtitle tracks in multimedia files.

## Transcript

Hello this is Stef! Welcome back to 
my channel so I remind you to like  
share and subscribe if you like 
the content that I'm providing.  
Now, today we're going to see something a 
bit different. So far we dealt with videos,  
we dealt with what to do with images we dealt 
with what to do with videos we did a lot with  
the video track we are going to see another type 
of track that is the subtitle track we're going  
to see how to extract subtitles how to burn 
subtitles how to manage subtitles in general
hmm okay
I see and how to manipulate them in order to 
include them in the file you want So at the  
moment I have a subunitu already behind 
me and so now it's time to get started
okay we here we have zuboon 2 ready and the video 
we're analyzing at this moment is a video called  
singtel sintel is made by the same house let's 
say that did that made a Big Buck Bunny so a  
video that we already seen that we already know 
this is a video that if you watch it is not as  
a light themed as a big bug bunny there's a bit 
more dense plot and it's a bit moving so I cried  
a little as soon as I watched this movie anyway 
it's remarkable for us because if we take a look  
using FF probe so now let's let's meet go to the 
right folder so here we have the latest version  
that we have so far we are trying to invoke FF 
Probe on this video and we'll see what is going on  
what are the tracks that are available right here 
okay as the local program you see that there is  
um so it's quite complex it's quite well done as 
a video something that we might expect out of a  
movie for example and here we see that there is a 
video input with the chapters but the the concept  
of the chapters is going to be seen another 
video um we have an audio track and a lot of  
subtitle tracks so here if you would like we can 
also invoke a probe to take the streams so let's  
see what it tells so I have a probe minus show 
streams and also let's see show format as well
this way yeah plane way and you see that right 
here we have all the indications of all the  
streams you have all the indications we see that 
the type of codec is a subrip and so let's have  
a look at what we can do so first of all let's 
have a look also at the available subtitles codex  
so even the subtitles have their own codecs so 
seems strange but it is like this so to inspect  
which are the um the tracks available sorry 
the types of subtitles available you can go  
and take a FM pack minus codex then we put a pipe 
with a research upon this track so we can take
there's a string of research so it's 
going to take what's in the beginning  
uh in the beginning you saw the indication if 
it is uh which type of codec which so in this  
case we want a subtitle track as this available 
and again I always forget to book it locally  
and here as you can see this is all the list 
of types of subtitles that we can use within  
our videos here we go uh among them there 
is a sub rip so subrip subtitles and so we  
can use it directly another way of taking out 
the subtitles out of your file is to invoke  
admin pack minus codex and again a pipe grab 
subtitle simple as that again local invocation  
and here you have all the lists as before so 
the same list can be wrapped in this way maybe  
this is easier the other is a bit more hacky 
with the the grab and stuff if you would like  
to extract the subtitles out of the video what 
we can do is to invoke headphone package again  
minus I name of the video so now we take as the 
input the input file and what we want is only  
the subtitle track so to invoke the subtitle 
track what we're going to do is to remove  
the video track so minus the end remove the audio 
tracks okay and among the subtitle tracks we're  
going to use for example the first so in this 
case what you have to do is to take the math  
then got to take the first file and we're going 
to select the first subtitle track that if I'm not  
wrong it was the German one so what I'm going 
to do now I'm going to take the type of codec  
in this case a minus C colon s s stands for 
subtitle that is available both in the map and in  
the codec here we're going to copy 
we want the track as it is and then
what we can say is take as output file a file 
that has the German language dot the native  
format for the subtitle stream subrip as it is 
available in the video is SRT let's see it works  
and here what it does is extracting all 
the subtitles that are out in the video  
here we go the type is a copy so they should 
be as they are within the video now let's see  
what's the content of this video this is 
a plain readable file differently from the  
video and the audio usually the audio 
in the video are binary requires some  
special treatment for the subtitles this is 
quite easy let's have a look as a subtitled  
we can open it directly using a text editor 
so we're going to use a VIN and let's take a
video and here we see all the results here you 
see the syntax that is inside our video inside our  
subtitles so you see that there's a progressive 
number for each subtitles you would like to take  
you see the instant you want to show the subtitle 
minus minus greater than sine so just a remarkable  
there is a text way to Mark um an arrow and 
then the end of showing of your subtitle so  
beginning and so the certain the some subtraction 
of the last and the first value is the duration of  
your uh of your subtitle and here you have your 
text here the text if you want you can put it in  
multiple lines here this is put in two lines so 
here you have the first line and the second line  
simply then all the entries must be separated 
by align the middle so it is as simple as that  
if you would like you can type in manually there 
are some programs that you would like to use it  
um you would like to use to make them better but 
this is all that you need to know to deal with the  
subtitles okay so we dealt with the SRT subtitles 
the subgrade Oma subtitles if you would like to  
use other types of subtitles you can so we saw the 
list also titles that you can use for example if  
you would like to use that dot ass subtitles what 
you can do is to convert the subtitles as well so
you can use the input also so subtitle as input 
as well and we can change it to the same name  
and in this case instead of putting SRT 
we put ass and everything is arranged by  
a fun pack so we have our DOT ass file 
if we open it using a text editor you  
will find the syntax that is slightly 
different so here you can see that the  
there's a different scanning you see dialog column 
the beginning and the end of the end of time it is  
more or less a CSV like so you see that there is 
all the effect the the resolver scanning of each  
line that you would like to display so a bit more 
uh complicated to read but it's here available  
in another form now we extract it before the 
German language but we would like to extract  
some more languages for us for me personally I'm 
Italian so I would like to take the English and  
Italian language but now I don't know which is 
the index of the different languages I think  
that I can do is to invoke FM pack in order to 
see all the languages available so we said the  
first language is the the German one so um we 
can okay invoke FF probe like this and see all  
the languages available again local style and 
remember here I have a German English Spanish  
French Italian Dutch polish Portuguese Russian 
and Vietnamese so for me the type of streams  
that I'm interested about are the English number 
three and the Italian then take whatever you want  
I don't want to uh so just just an example 
so what they can do is uh to invoke FM pack  
minus I name of the video then I take minus VN 
that stands no video take minus uh a n no audio  
and then I'm selecting through the map the if you 
can't remember how the map works I put the video  
here in the cart and what I would like to 
map is the first sorry the um Italian and  
the English strikes so these are respectively the 
number three and the number six what I can do is  
uh to take either the um absolute crack or the 
relative track according to the type of string  
that I want so here uh what I can do is to put 
the file number zero and the track number three  
something like this and then 
I'm going to make a CS copy  
and the name of the file as 
a singtel well la English
dot SRT so the same format as before
and now I have my English subtitles now 
I'm going to check Vim name of the file  
and here I see that my subtitles are in English 
what I would like to do is to also use the same  
command that I used before so this one but instead 
of putting the absolute track so this is the track  
number three remember here we have S track the 
number six that is the first second third fourth  
fifth track in the sequence so the fifth track is 
a track number four and what you can do is a zero  
that was up our stream they want is a 
subtitle and the track is number four  
here I take everything as it 
was before so here I put Italian
I extract the video I'm sorry the 
subtitle and here I have my Italian  
thread let me check if this is a really 
the Italian one if I didn't miss any counts
and it seems Italian okay so 
this is uh the right one cool  
okay now I have my English track I have my 
Italian track what I would like to do now is  
to create a video with only the audio the video 
and the subtitles so what I would like to do  
is to invoke again a fun pack minus I in this 
case I get to take the first the second and  
the third file so first this then my sub first 
subtitle track then the other subtitle track  
so my three files are rightly put then 
I got to take the video from the first  
frame so I can take a map from the first 
file I'm going to take the video tracks  
from the first file I'm going to take again all 
the audio tracks and so for the other I'm going to  
take the subtitle tracks so I can take something 
like this it has to be complete minus map  
yeah for the third file by number two I take 
the same subtitle crash and then in the end  
I'm going to create my file my file can be with 
the same name and with the reduced languages  
so what I can do is something like a singtel 
let's say Italian and so English Italian and
so I want a matrushka video just suppose a thing  
like this I think that supports a copy 
all the tracks so I would like to do uh
called B of everything so I can do also more 
easily set of setting the video the audio and the  
subtitles what I can do is to put a minus C P so 
everything will be a copy no transcoding implied  
see if it works it seems to work  
now it's putting all together and let's see what's 
the result so everything is done in a copy way  
and let's see if the video is played so I'm 
going to open it with VLC and see that the  
video is played perfectly I'm going to check also 
if the titles are rightly put so here we've got  
the two tracks one I suppose it is the English 
the other I suppose it is the Italian let's hope
so there's the the scene in the center 
that has a dialogue I got to search for it
and the
matter here it is so here we have a the subtitles 
in English and if I change to the other subtitles
we have the subtitles in Italian so cool that's 
what we wanted okay good so now we have a video  
uh we have a languages but if we open this 
video what we have is a video that has the  
subtitle as we want but it doesn't have the 
references that are correct in the subtitle  
so if you see the subtitle track you see there is 
track one track two but they're not so meaningful  
they don't mean anything to us so we don't 
know if the first is the English the other  
is the Italian here it seems like the first 
is the English one so what do you like to do  
is to detect to tell the software that we are in 
uh so we want the scanning of all the subtitles  
so how can we do this thing we're going to invoke 
action pack and we have to set a special metadata  
entry so here we're going to invoke FM pack 
on our input files as we did before so minus I  
burst file minus I second file that is the English 
subtitles then another I the Italian subtitles  
then what we will need to do is to map these 
files accordingly so what can we do is uh to  
take the map uh video from the first file 
and also map the audio from the first video  
cool then what we're going to take is from the 
second file we're going to take the subtitles  
and the other has the subtitle 
as well so we have a first video  
then so video from the first file audio from 
the first file subtitles from the second file  
and subtitles from the second file so since 
we have single streams we don't need to map  
accordingly this is a to make the things easier 
okay so another thing that we can do is uh to  
set the titles accordingly so what can we do is 
to set with the metadata flag so minus metadata
the name of the flag so the name of 
the stream the name of the stream  
has to be put with the following 
syntax so we got to put metadata  
no spaces so a column that 
tells that this is a stream then
the we got to put a second s the s 
in this case refers to the subtitle  
string so we want to take the first stream 
as subtitles and uh the English language and  
the other subtitle as the Italian language 
in an equivalent way we could also uh put  
a thing like this so stream two so it does the 
same thing but to be a bit clearer I'm going to  
say that this is the first subtitle track and 
what we need to put is a language to be said in  
English so the language need to have a certain 
uh think text so with three letters the three  
letters are like the iso language style language 
code and in this case the language is English  
and then finally we can put our output file 
the output file in this case we can take either  
the same in this case so we can take English 
Italian metadata sets so just to have a more  
remarkable name um yes so I forgot the thing for 
the Italian language so here got to put metadata
again s s one because the second subtitle stream 
is related to the Italian language the language  
equals to Eta that is for Italy Italian let's see 
if the command works and now it's working we are  
waiting for the result it should be pretty 
fast because we are doing we are performing  
um a string copy no it's no way not to perform 
a string copy no I'm I'm wrong so I got to quit  
the process here got to put in the end after 
the language the minus C topic so sorry guys
I was wrong and now we got the set the languages 
let's see it now it works takes a while
but should be pretty fast okay good 
finished and now let's give an FF probe  
just to understand if our languages are set 
correctly they should be the metadatum with  
the name of the language so here FF probe 
and there's a foreign we just created  
and we see that there is the stream for the 
subtitles so the first is for the English the  
other is for the Italian so good we did what 
we needed we needed to do if you would like to  
play the video also we can open it with the VLC 
and VLC shows here in the subtitles and subtitle  
track we got the track one English and the second 
one Italian so that's the thing that we wanted  
okay so we uh if we want now to put the subtitles 
as burned on our video so for example we want the  
subtitle always be present uh on a video and 
not as a subtitle track we got to heartburn  
the subtitles on top of the video this can be 
done using a filter so there is the subtitles  
um subtitles filter and it works in this way 
we have a FM pack we invoke the input file  
as this in this case we don't um give the name 
of the input in the um in the FM back comment  
but we give it as input in the filter subtitles 
that we see later so minus VF or minus filter
B subtitles is the name of the filter and then 
we're going to take the name of the file so in  
this case uh let's use the English one and then 
we can put as output the name of our file so since  
this is a video that uses a filter we cannot 
stream copy we need to re-encode the video so  
we got to give the information about the video 
in this case we can put h264 um then we're going  
to put the CRF the contrast the concentrate 
factor of zero so it's a pretty big um so big  
but preserving the quality presets slow to be 
as slow as possible and then generate a video  
with the best quality possible without any nasty 
artifacts and the the audio we can copy it so  
we can take the Stream so the video 
must be done from scratch the audio  
can be kept so what you can do is something 
like this we put the hard burned subtitles  
and here we can change the video to MKV and 
then we can run the program it can take a while
and so we are going to wait until the end of 
the processing okay so now the video finished  
and we are ready to play it when we play it 
and reach a point where we have subtitles  
here we can see that the subtitles are heartburned 
just a little time and see that there is a a slow  
system and here you can see that this subtitle 
is hard coded so there is no reference about  
the subtitles tracks okay so today we dealt with 
subtitles uh we dealt how to manage the subtitles  
and how do they appear at least format a couple 
of formats and then we saw how to include the  
subtitles within the videos and also how to 
include the language inside the metadata so  
now we have the reference within the video and 
with the different languages if you would like  
to put a multi-language subtitles if you want 
to hard burn your uh your subtitles within the  
frames you can do it with the filter V subtitles 
and the name of the title file you would like to  
put and you had subtitles directly put inside 
the video we don't see the advanced options so  
you can change the font you can change the 
style you can change many things you can  
also pay particular attention when you crop when 
you trim the video so it takes something in the  
middle it requires some particular attention for 
the moment this is the basis with which you wear  
um you can work with if you want to deal with 
subtitles so thank you very much for watching  
if you reach this point uh I suggest 
to like share and subscribe and hit  
the notification Bell here down below and 
thank you very much and see you next time  
with new content regarding multimedia streams 
and FM pack and much much more so bye ciao ciao
thank you
