Improve ffmpeg CPU usage by compromising quality

2.6k views Asked by At

I am using FFMpeg for screen capturing. I am looking for a screen capturing tool that will run on 1000 of VMs (windows and mac).The VMs have limited CPU (1 core) and 2GB ram and No GPU.

Currently I invoke ffmpeg with

ffmpeg  -y -framerate 8 -f dshow -f gdigrab -i "desktop"  -c:v libx264  -crf 0 -preset ultrafast -threads 0 temp.mkv

I am using gdigrab to capture screen? Is there any better options that might reduce cpu usage? or changing the encoder or format?

I am aiming for 4-5% reduction in CPU usage.

Thanks in advance

2

There are 2 answers

4
szatmary On

Using -profile baseline and enabling -tune zerolatency to turn of some extra features should help a bit. Otherwise, you will need to use a different codec than h.264.

4
Ely On

What is your source's resolution ? If it's big (like 1080p or 720p), have you considered downscaling first to 480p / 404p ?

Otherwise, it's better to just change the codec. I'd suggest you first try "-c:v mpeg4". If it is still too slow, go for "-c:v mpeg2video".