[FFmpeg-user] FFmpeg Thread Command - Performance, Quality & Encoding Size

Carl Eugen Hoyos ceffmpeg at gmail.com
Fri Oct 11 11:37:38 EEST 2019

> Am 11.10.2019 um 07:51 schrieb Anand Veerappan <anandzone at gmail.com>:

> While encoding a video file using FFmpeg we have option to handle thread
> parameter. I used Quad Core Processor and find below my observations.
> *Case 1: Default thread usage*
> By default if we didn't specify thread value FFmpeg internally adjusts
> thread count usage based on the core architecture of the deployment machine.
> Example:
> ffmpeg -i football_1080p.mp4 -c:v libx264 -b:v 3M -bufsize 6M -maxrate
> 4.5M  -g 120 -tune psnr -report football_1080p_3M_threads_1_p.mp4

libx264 defaults to using as many threads as the system provides cores iirc (this is not really FFmpeg-related).

> If I repeat this command n times for encoding always the encoded file size
> is similar in all iterations.

But - as you found out - this is not true in general. The fact that multi-threaded encoding can lead to different output is not related to FFmpeg or libx264 but a property of multi-threaded computing in general (you can of course implement the multi-threading with a synchronisation to achieve identical results but in the case of video encoding this additional complexity that leads to a lower encoding speed is not wanted).

Carl Eugen

More information about the ffmpeg-user mailing list