How to Run FFmpeg with Lower Process Priority
Running resource-intensive video encoding tasks with FFmpeg can easily consume your entire CPU, causing your operating system to lag. This article provides a quick and direct guide on how to configure and run the FFmpeg command with lower process priority on Windows, Linux, and macOS, ensuring your system remains responsive for other tasks while your media processes in the background.
Linux and macOS (Using
nice)
On Unix-like operating systems, you can use the built-in
nice utility to launch FFmpeg with a lower CPU scheduling
priority. Niceness values range from -20 (highest priority) to 19
(lowest priority/most “nice” to other processes).
To run FFmpeg at the lowest priority, prepend your command with
nice -n 19:
nice -n 19 ffmpeg -i input.mp4 output.mp4If the FFmpeg process is already running, you can lower its priority
dynamically using the renice command combined with the
process ID (PID):
renice +19 -p <PID>Windows Command Prompt
(Using start)
In the Windows Command Prompt (cmd.exe), you can use the
start command to initiate a process with a specific
priority class. The available options for lowering priority are
/belownormal and /low.
To run FFmpeg at the lowest priority level:
start /low /b ffmpeg -i input.mp4 output.mp4Note: The /b switch is highly recommended because it
forces the application to run in the current Command Prompt window
instead of opening a new one.
Windows PowerShell
(Using Start-Process)
If you are using PowerShell, you can lower the process priority using
the Start-Process cmdlet with the
-PriorityClass parameter. The target values for lower
priority are BelowNormal or Idle.
To run FFmpeg with the lowest (Idle) priority:
Start-Process ffmpeg -ArgumentList "-i input.mp4 output.mp4" -PriorityClass Idle -NoNewWindow -WaitNote: The -NoNewWindow switch keeps the output in
your current shell, and -Wait ensures PowerShell waits for
the encoding to finish before accepting new commands.