How to reduce CPU usage when it reaches 100% during video reencoding

7,555

Solution 1

  1. task manager
  2. then detail tab
  3. right click on ffmpeg.
  4. Select affinity
  5. uncheck all the cores except 1.

What it to use more check at 2nd one. Keep checking boxes until you get the desired results.

Solution 2

Try -threads 2 parameter on your FFMPEG launch script, you can limit used threads by using that flag.

Share:
7,555

Related videos on Youtube

Đỗ Mạnh Trí
Author by

Đỗ Mạnh Trí

Updated on September 18, 2022

Comments

  • Đỗ Mạnh Trí
    Đỗ Mạnh Trí almost 2 years

    I'm using the following command to change a video:

    ffmpeg -loop 1 -i max.png -i video.mp4 -i 1.flv -filter_complex "
    [1:v]scale=1280x720,setpts=PTS/1.15[a];[2:v]scale=750:420,setpts=PTS/1.15,pad=iw+5:ih+5:2:2:color=black[b];[0:v][a]overlay=10:(main_h/2)-(overlay_h/2)[a]; [a][b]overlay=(main_w-overlay_w-0.1): (main_h-overlay_h-0.1):shortest=1,setdar=16/9[video],[1:a][2:a]amix=inputs=2:duration=shortest,atempo=1.15,volume=1.6,equalizer=f=1000:width_type=o:width=1:g=1,equalizer=f=1000:width_type=o:width=1:g=2,equalizer=f=1000:width_type=o:width=1:g=3,equalizer=f=1000:width_type=o:width=1:g=4,equalizer=f=1000:width_type=o:width=1:g=5,aecho=0.8:0.88:6:0.1,aecho=0.8:0.88:6:0.2,aecho=0.8:0.88:6:0.3,bass=g=3:f=110:w=1,bass=g=3:f=110:w=2,bass=g=3:f=110:w=3,pan=stereo|c0<c0+0*c1|c1<c0+0*c1,aeval=-val(0)|-val(1)[audio];[video][audio]concat=n=1:v=1:a=1
    " -vcodec libx264 -pix_fmt yuv420p -r 30 -g 60 -b:v 1000k -minrate 1000k -maxrate 1000k -profile:v main -level 3.1 -acodec libmp3lame -b:a 228k -ar 44100 -preset fast output1.mp4
    

    This Image is my case As you can see the CPU usage is pretty high and I would like to reduce it to about 30-40%. But I don't know how to achieve this?

    • cybernard
      cybernard about 7 years
      If you reduce the CPU usage it will take that much longer to complete. It is designed to run at 100% so it completes in the minimum amount of time.
    • Seth
      Seth about 7 years
      You might want to include some details about your hardware as it might be relevant (CPU and GPU). You might be able to offload some of the work to the GPU (not sure about that) or use what's detailed in How can I limit FFMpeg CPU usage?.
  • Đỗ Mạnh Trí
    Đỗ Mạnh Trí about 7 years
    Thanks guy. One more. If I want to use GPU (I have 8Gb RAM) to render, How I can do that ?
  • cybernard
    cybernard about 7 years
    @ĐỗMạnhTrí trac.ffmpeg.org/wiki/HWAccelIntro That should get you started.