FFMPEG Command to Add Subtitles to Video Using SRT File in Terminal
71 views
Jun 3, 2025
ffmpeg -i video.mp4 -vf "subtitles=subs.srt:force_style='FontSize=48,PrimaryColour=&HFFFFFF&'" -c:v libx264 -pix_fmt yuv420p output_with_subs.mp4
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you a sfmppg
0:04
command which will actually take all the
0:06
your subtitles which are mentioned in
0:08
the subsrt file so it if you create a uh
0:12
subtitle file right
0:14
here there is a f ofmppg command which
0:17
will take this input video which doesn't
0:20
contain the
0:21
subtitle and it will create this new
0:23
file output with subtitle and it will
0:27
take all the subtitles which are
0:28
mentioned in this SRT file as you can
0:30
see right here it will add these
0:32
subtitles so I will show you this
0:34
command which is really useful for
0:37
actually adding subtitles to your video
0:40
so it's a single command i have given
0:42
this command in the description of this
0:43
video so now to get started here so
0:46
first of all you need to create a
0:48
subtitle file in the same directory so
0:51
it will be a simple subtitle file right
0:54
here we give the timestamps so from 1
0:58
second to 4 second you basically put
1:00
this text hello welcome to our video
1:02
tutorial and then from the fifth second
1:05
to 8 second you can see that this is a
1:07
second one second subtitle this is the
1:11
third subtitle this is your time stamp
1:14
this is the fourth one fifth one so five
1:17
subtitles are there and uh now I will
1:20
show you the command
1:22
here so I've given this command in the
1:25
description of this video so just open
1:28
your command line and just paste this
1:30
command
1:32
fmpp i and this is your input file here
1:36
which is video.mpp4
1:38
mp4 here we are we are providing this if
1:41
you see
1:42
that the input file here video.mpp4 so
1:46
we are simply providing it and then in
1:47
sub double quotes we are providing this
1:50
video filter subtitles is equal to subs
1:54
srt so this is the file that we are
1:57
providing and then for style font size
2:01
you can control it 48 you can even
2:03
control the color of the subtitle so we
2:06
providing this hexa decimal code here
2:09
and then we are putting this
2:11
encoder and then this is your output
2:14
file so these are two encoders lab 264
2:17
and yuv 420p so if you execute this
2:21
command here it will now process this
2:23
video it will
2:25
actually add all the subtitles which are
2:28
mentioned in the file inside your video
2:31
so this will not take a lot of time it's
2:34
a simple 30 secondond video and then it
2:37
will add all the subtitles right here so
2:39
just wait for the command to finish and
2:42
now you can see it has created a new
2:45
file and if I play this you will see
2:47
that the subtitles are being
2:50
successfully
2:51
added can see that let me also open it
2:55
in a media
3:01
player so you can see that guys so in
3:04
this frame per second of a particular
3:07
video or also speed of a video using
3:10
FMPG right in the
3:12
1.MP4 and so the command is given guys
3:16
in the description of this video and uh
3:19
thank you very much for watching this
3:21
please hit that like button and also
3:22
check out my website
3:24
freemediatools.com which contains
3:26
thousands of tools