How to Run FFmpeg with Higher Process Priority
FFmpeg does not have a built-in command-line flag to control its own CPU scheduling priority. Instead, you must rely on your operating system's process management tools to allocate higher priority to the FFmpeg process. This guide explains how to increase FFmpeg's process priority on Linux, macOS, and Windows to ensure your media encoding tasks receive maximum system resources over other background applications.
Linux and macOS
On Unix-like systems, process priority is managed using "niceness"
values ranging from -20 (highest priority) to
19 (lowest priority). The default priority for standard
processes is 0.
Starting FFmpeg with High Priority
To launch FFmpeg with elevated priority, use the nice
utility. Because setting a negative nice value requires administrative
privileges, you must prepend the command with sudo:
sudo nice -n -10 ffmpeg -i input.mp4 -c:v libx264 output.mp4In this command, -n -10 assigns a high-priority state.
For maximum priority, you can use -n -20, though this may
cause system responsiveness issues if system-critical threads are
starved.
Changing the Priority of a Running Process
If FFmpeg is already executing, find its Process ID (PID) and use the
renice command:
# Find the PID
pgrep ffmpeg
# Adjust priority using the PID
sudo renice -n -10 -p <PID>Windows
Windows manages priority using discrete priority classes:
Low, BelowNormal, Normal,
AboveNormal, High, and
Realtime.
Using the Windows Command Prompt (CMD)
You can launch FFmpeg with high priority using the start
command. Run the following in Command Prompt:
start /high ffmpeg -i input.mp4 -c:v libx264 output.mp4Note: Avoid using /realtime, as it can completely
freeze input devices, networking, and system-critical drivers.
Using PowerShell
To launch the process via PowerShell with higher priority:
Start-Process ffmpeg -ArgumentList "-i input.mp4 -c:v libx264 output.mp4" -Priority HighChanging the Priority via Task Manager
If FFmpeg is already running:
- Press
Ctrl + Shift + Escto open Task Manager. - Navigate to the Details tab.
- Locate
ffmpeg.exein the list. - Right-click the process, hover over Set priority, and select High.
Maximizing CPU Utilization via Threading
Process priority only determines which task gets CPU time when multiple tasks are competing for resources; it does not automatically force FFmpeg to use all CPU cores. To ensure full resource utilization alongside high priority, configure FFmpeg's native threading parameters:
ffmpeg -threads 0 -i input.mp4 -c:v libx264 output.mp4Setting -threads 0 instructs FFmpeg and supported
encoders (like libx264 and libx265) to
automatically detect and utilize all available CPU threads.