Ffmpeg maximum cpu utilization

I have a 32 thread cpu dedicated server.
I’ve configured the kaltura ffmpeg to run with -threads 0

I expect ffmpeg to use all of the 32 cores at full power.
What actually happens is that there is use of all 32 cores but not at 100% of each core.

Is there something else to add/change in the parameters?

As far as I know, you won’t necessarily get 100% CPU utilization. I think ffmpeg will open a child for each flavour but will not shorten the transcoding time by the number of threads.

As an example, I have a live nginx-rtmp /ffmpeg setup with 4 real time transcoding flavours and 4 simultaneous live channels. The average CPU per thread is 40% and follows the colours changes. The more contrast changes you have, the more CPU will be used.

Other factors apply. If you have a SSD storage you will get a faster conversion than if you use a normal SATA storage.

I think it’s normal.

can you give me details how you configured kaltura ffmpeg to run with -threads 0

Try something like this:
exec /usr/bin/ffmpeg -i rtmp://localhost:1935/$app/$name -g 60 -vprofile baseline -c:v libx264 -pix_fmt yuv420p -c:a aac -b:v 574k -b:a 48k -vf “scale=640x360” -tune zerolatency -preset veryfast -f flv rtmp://localhost/live01/$name_360p;
exec /usr/bin/ffmpeg -i rtmp://localhost:1935/$app/$name -g 60 -vprofile baseline -c:v libx264 -pix_fmt yuv420p -c:a aac -b:v 1152k -b:a 96k -vf “scale=850x478” -tune zerolatency -preset veryfast -f flv rtmp://localhost:1935/live01/$name_480p ;
exec /usr/bin/ffmpeg -i rtmp://localhost:1935/$app/$name -g 60 -vprofile baseline -pix_fmt yuv420p -c:v libx264 -c:a aac -b:v 1280k -b:a 96k -vf “scale=1280x720” -tune zerolatency -preset veryfast -f flv rtmp://localhost:1935/live01/$name_720p;

Just break each flavor into a different exec


Personally I changed -threads 4 to -threads 0 straight in the kaltura database, flavor_params table and the conversion_engines_extra_params field for every flavor that I wanted.

Just a subjective observation,

When opening different one-thread exces, I noticed that all flavours and audio were more in sync. Maybe is just a feeling but I rarely have lip-syncs and other problems that were common with Wowza, for instance.