WyattBlue / auto-editor

Auto-Editor: Efficient media analysis and rendering
https://auto-editor.com
The Unlicense
2.71k stars 402 forks source link

FFmpeg is CPU intense #434

Closed Sneffel closed 3 months ago

Sneffel commented 5 months ago

FFmpeg uses too much CPU, all it can have to the ceiling, even 90% of the total. I'm on a commercial build of AMD 64. It makes the PC freeze and crash. How can I limit the processing to 50% of the CPU?

I'm calling auto-editor like this:

@echo off set "input_file=%~1" "C:\Users\Username\AppData\Local\Programs\Python\Python312\Scripts\auto-editor.exe" --margin 1s,2sec --no-open "%input_file%" --my-ffmpeg %ffmpeg_threads% -c:v libx264 -b:v unset --extras "-preset slow -crf 22" pause

petermg commented 4 months ago

FFmpeg uses too much CPU, all it can have to the ceiling, even 90% of the total. I'm on a commercial build of AMD 64. It makes the PC freeze and crash. How can I limit the processing to 50% of the CPU?

I'm calling auto-editor like this:

@echo off set "input_file=%~1" "C:\Users\Username\AppData\Local\Programs\Python\Python312\Scripts\auto-editor.exe" --margin 1s,2sec --no-open "%input_file%" --my-ffmpeg %ffmpeg_threads% -c:v libx264 -b:v unset --extras "-preset slow -crf 22" pause

If you have a supported AMD or Nvidia GPU and a version of ffmpeg that supports GPU encoding you can just set the video codec to use the GPU encoder. For example I do this: auto-editor %1 --my-ffmpeg -c:v hevc_nvenc -m 5,30 this USED to work fine but now it throws an error that you cannot use that codec with mp4 files. I think this is a bug because like I said it used to work fine on mp4 files. I reported the issue, so in the meantime you can just tell it to output it as mkv, which works without that error. So it would look like this: auto-editor %1 --my-ffmpeg -c:v hevc_nvenc -m 5,30 -o outputfile.mkv

Now that is for a supported Nvidia GPU using a version of ffmpeg that supports GPU encoding. This way it will use hardly any of your CPU and offload the encoding to the GPU instead.

WyattBlue commented 3 months ago

Try using a gpu video encoder (-c:v h264_nvenc) if your computer has a supported GPU. Otherwise, try either increasing your fan speed in the BIOS or set an option to somehow rate limit your CPU.

(closing because there's nothing to do here on the software side)