I am trying to get one frame per second from a video. And I need to do it in a fastest way. First my assumptions were that I should use GPU instead of CPU. But my test shows that I can’t get the same speed improvements as for decoding/encoding on GPU.
For instance, on aws g3s.xlarge instance I have only 2.5 speed increasing rate with GPU (hardware accelerated encoding is in average 7 times faster than software encoding on this instance)
So I have two questions for now:
-
Is it worth using GPU for frames extraction?
-
What is the fastest way for getting frames from video?
I am using for GPU:
<li>ffmpeg -hwaccel cuvid -c:v h264_cuvid -i test.mp4 -vf "thumbnail_cuda=100,hwdownload,format=nv12,fps=1" frames/thumb%03d.jpg</li>
and for CPU:
ffmpeg -i test.mp4 -vf fps=1 thumb%03d.jpg