FFMPEG Tutorial to Enable NVIDIA or AMD GPU Acceleration to Speed Up Encoding of Videos in Terminal
Jun 3, 2025
ffmpeg -i input.mp4 -c:v h264_nvenc -preset fast -c:a copy output.mp4
ffmpeg -i input.mp4 -c:v h264_qsv -preset fast -c:a copy output.mp4
ffmpeg -i input.mp4 -c:v h264_amf -b:v 5M -c:a copy output.mp4
Show More Show Less View Video Transcript
0:00
uh hello guys uh welcome to this video
0:02
so in this video I will show you how to
0:04
enable uh your GPU graphical processing
0:08
unit inside your ffmpg command to speed
0:12
up the process to boost the speed of
0:14
conversion because essentially ffmpg
0:17
commands take a lot of time because if
0:19
you are executing a complex command then
0:21
it will take a lot of time but if you
0:24
have a dedicated uh GPU which is
0:28
different from your CPU uh graphical
0:30
processing unit so in my system there is
0:34
a GPU dedicated GPU so now to enable
0:36
that inside your command so there is a
0:39
particular filter you just need to add
0:41
here so let me show you a very simple
0:44
example we have this input file right
0:46
here 1.MPP4 so just open the terminal
0:49
right here just write this command
0:52
fmppi uh the name of the file here
0:55
1.mpp4
0:57
and after that let's suppose I want to
0:59
re-encode this
1:03
video we provide this and then by
1:06
default it use this
1:08
uh encoder which is lib
1:14
x264 this is actually the encoder
1:18
which this uses the CPU by default fmpg
1:22
uses CPU by default so that's why you
1:25
are not getting uh a faster conversion
1:29
time so now if you want to just uh boost
1:33
the
1:34
speed so then you can actually enable
1:37
the graphical processing unit for
1:39
enabling that we just need to write the
1:41
name of the GPU in my case I'm using
1:44
Nvidia GPU
1:47
so now to enable that we simply write
1:51
H264 NV and C so this is the name of the
1:57
GPU here right here nvidia GPU graphical
2:00
processing unit so
2:03
H264
2:05
NVNC this is the name of the processor
2:08
and after that we also have uh presets
2:12
that we can also use we have different
2:15
presets it can namely ultraast normal uh
2:20
you also have high
2:22
low so
2:25
ultraast is the f most faster one which
2:29
is available which will take very less
2:32
time in converting your videos and then
2:35
we just actually write the basically
2:38
whatever we are doing so we are encoding
2:41
the
2:42
video so essentially this is a command
2:45
you can use this with any command you
2:47
just need to write
2:49
H264
2:51
NBNC-pet ultraast so you can essentially
2:54
do anything you can convert your video
2:56
to MP3 you can re-encode the video so
2:59
just need to write this inside your
3:01
command H h264 NBNC so now what
3:06
happens you will see it
3:12
will so it is saying unable to parse
3:15
option value ultra
3:17
fast so I think ultraast is not
3:20
available for this so we just need to
3:22
replace it by fast so just execute now
3:25
if you see the speed is doubled you will
3:28
see speed is
3:31
31.4x so now it actually converted the
3:34
video in very less amount of time
3:36
because it actually uses the dedicated
3:41
GPU if I don't use this if
3:45
I if I don't use this you will see it
3:48
will not it will take a lot of time let
3:52
me remove this
4:02
so you can
4:06
see the speed is
4:08
8.28 so you can see it is taking a lot
4:11
of time when GPU is not enabled
4:17
so you can see still it is converting
4:20
but the previous thing was converted in
4:23
a flash because we were using Nvidia GPU
4:26
let me cross check just open your task
4:30
manager just to see if your GPU is has
4:33
been used so right here in the
4:36
performance here you can definitely
4:38
cross check if I execute this command
4:43
here so just see here your dedicated GPU
4:46
is used right here so this
4:48
is GPU to 90% is using
4:55
so it it will actually boost the speed
4:58
conversion time because it is not using
4:59
your CPU it is using your Nvidia
5:04
GTX card here
5:07
so if you basically there are two types
5:09
of GPU uh if you are using AMD GPU so if
5:15
depending upon you just need to check
5:17
the company here i'm using this one
5:19
Nvidia GPU so there is also a second
5:22
kind of GPU as well which is
5:25
AMD if you want to enable that one if
5:29
you're using these graphic cards there
5:31
is a different command i've given all
5:34
these three commands in the description
5:35
of this video you can check right here
5:38
so for this you just need to replace
5:41
it let me show you
5:44
so for this one AMD GPU you just need to
5:48
write
5:49
H264
5:52
AMF so this is the change that you need
5:54
to do if you are using AMD GPU the rest
5:57
of the thing will remain constant
6:01
so so this is a very useful trick if you
6:05
want to boost up speed of your fmpg
6:07
conversion if you want to take less time
6:10
then you can enable GPU so thank you
6:13
very much for watching this video and
6:14
also check out my website
6:16
freemediatools.com
6:18
uh which contains thousands of tools
#Multimedia Software
