FFmpeg: How to limit CPU usage


I have a server with 4core, when i run a command ffmpeg, cpu load high:

ffmpeg -i 0.mp4 -i video_7.mp4 -i 0.mp4 -filter_complex "[0:0][1:0]scale2ref[v0][ref];[v0]setsar=1[v00];[2:0][ref]scale2ref[v2][ref2];[v2]setsar=1[v20];[v00][0:1][ref2][1:1][v20][2:1]concat=n=3:v=1:a=1[v][a1]" -max_muxing_queue_size 400 -map [v] -map [a1] -y output.mp4

CPU load about 3 to 4:

ffmpeg high cpu

How to reduce CPU load when use ffmpeg

You add -threads n with n is number of thread you want to run with ffmpeg, eg: -threads 2

Example :

ffmpeg -i 0.mp4 -i video_7.mp4 -i 0.mp4 -filter_complex "[0:0][1:0]scale2ref[v0][ref];[v0]setsar=1[v00];[2:0][ref]scale2ref[v2][ref2];[v2]setsar=1[v20];[v00][0:1][ref2][1:1][v20][2:1]concat=n=3:v=1:a=1[v][a1]" -max_muxing_queue_size 400 -threads 2 -map [v] -map [a1] -y output.mp4

Now CPU load about 2:
ffmpeg limit cpu

Recent search terms:

  • https://tutorialspots com/ffmpeg-how-to-limit-cpu-usage-4758 html

Leave a Reply