[FFmpeg-user] Best way to record video on a computer with a really bad CPU yet really good GPU?

Sven C. Dack sven.c.dack at sky.com
Sun Sep 4 11:16:03 EEST 2016


On 04/09/16 07:46, happysmash27 at vmail.me wrote:
> I am attempting to screencast using ffmpeg on my PC, but I have one problem: 
> it uses too much CPU, even using `-crf=0`. Does anyone know how I can reduce 
> this, either using a REALLY lossy format or using my Radeon RX 480? Even if 
> it's not that efficient on my GPU, at least it will take some load off my 
> Intel Core 2 Quad Q9450...
>
> Also, for some reason using `-hwaccel auto` still uses CPU. Have I compiled it 
> wrong? Or does it really need to use 100% of it...

The first thing you can do is to reduce the frames that get grabbed per second. 
try this:

$ ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f rawvideo /dev/null
(I.e. 30fp/s, 2gbit/s)

This will tell you how fast you can grab at the most. Here the screen size is 
set to be 1920x1080. Then reduce it with the "-r" option:

$ ffmpeg -f x11grab -s 1920x1080 -r 10.0 -i :0.0 -f rawvideo -y /dev/null
(I.e. 10fp/s, 600mbit/s)

You can then scale the video down to reduce the amount of data further to give 
the encoder less work:

$ ffmpeg -f x11grab -s 1920x1080 -r 10.0 -i :0.0 -s 1280x720 -f rawvideo -y 
/dev/null
(I.e. 10fp/s, 300mbit/s)

Then put it through the encoder:

$ ffmpeg -f x11grab -s 1920x1080 -r 10.0 -i :0.0 -s 1280x720 -c:v libx264 -crf 
15 out.mkv
(i.e. 10fp/s, 1000kbit/s)

I am not sure if the "-crf" value has much impact on the CPU usage. Try using 
the "-preset" parameter instead:

$ ffmpeg -f x11grab -s 1920x1080 -r 10.0 -i :0.0 -s 1280x720 -c:v libx264 
-preset fast -crf 15 out.mkv

You can try "fast", "faster", "veryfast", "superfast". See the encoder options 
for more detail. There should also be some documentation about screen grabbing 
in general at the ffmpeg web site.

Sven



More information about the ffmpeg-user mailing list