Skip to content

Instantly share code, notes, and snippets.

@nd3w
Last active May 26, 2026 08:14
Show Gist options
  • Select an option

  • Save nd3w/d4ac894002e2c36a2a37accb07ee5cab to your computer and use it in GitHub Desktop.

Select an option

Save nd3w/d4ac894002e2c36a2a37accb07ee5cab to your computer and use it in GitHub Desktop.
Downscale An MP4 File Using FFMPEG and CPULimit

A Processor Friendly Guide to Downscale MP4 File Using FFmpeg, cpulimit and nice

A practical walkthrough for reducing video resolution and file size, optimized for low processor load, cooler temperatures, and smooth performance on any machine.

Working with high-resolution video doesn't have to mean melting your computer. Whether you're editing a 4K clip on an older laptop or simply trying to share a video without maxing out your CPU fan, downscaling is one of the most effective tools you have, and most people are doing it the hard way.

What I use for this guide:

  • A working computer (Intel© Core™ i5-4460 CPU @ 3.20GHz × 4)
  • 16 GB of RAM
  • Linux Mint 22.3
  • A connection to internet (to download apps)

A brief observation I found that the highest percentages of CPU used were: 36% on CPU1, 24% on CPU2, 23% on CPU3 and 29% on CPU4 but they change all the time. The CPU temperature rarely went beyond 57°C.

Feel free to tweak the command to fit your preferred workflow.

Install FFmpeg

sudo apt update && sudo apt install ffmpeg

Downscaling

Basic Conversion to 480p

ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -crf 23 -c:a copy output.mp4

With CPU Usage Limiting

ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -crf 23 -threads 2 -c:a copy output.mp4

Even gentler on the CPU

ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -crf 23 -preset slower -threads 2 -c:a copy output.mp4
Option Meaning
-vf scale=-2:480 Resize to 480p height, auto-width (keeps aspect ratio)
-c:v libx264 H.264 video codec (widely compatible)
-crf 23 Quality level — lower = better quality, larger file (range: 0–51)
-preset slower Slower encoding = less CPU spike + better compression
-threads 2 Limit to 2 CPU threads
-c:a copy Copy audio as-is without re-encoding

Combine with nice

For a background job that won't compete with your other tasks, you can also combine it with nice

nice -n 19 ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -crf 23 -threads 2 -c:a copy output.mp4

Using cpulimit for a processor-friendly process

Install cpulimit

sudo apt install cpulimit

Run FFmpeg Under cpulimit

cpulimit -l 50 -- ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -crf 23 -c:a copy output.mp4

Replace 50 with your desired CPU percentage cap.

How cpulimit Counts Persentage

  • 100 = 100% of one core
  • 200 = 100% of two cores
  • So on a 4-core CPU, 400 would be full usage, 50 would be ~12.5% of total capacity

This means if you want to cap FFmpeg to, say, 30% of your total CPU on a 4-core machine, you'd use -l 120 (4 cores × 100 × 0.30).

Combine with nice

For a background job that won't compete with your other tasks, you can also combine it with nice

nice -n 19 cpulimit -l 50 -- ffmpeg -i input.mp4 -vf scale=-2:480 -c:v libx264 -crf 23 -c:a copy output.mp4

Bonus

Flip horizontally

nice -n 19 cpulimit -l 60 -- ffmpeg -i input.mp4 -vf "hflip" -c:a copy output.mp4

No downscaling resolution

nice -n 19 cpulimit -l 100 -- ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a copy output.mp4

Downscale to 720p

nice -n 19 cpulimit -l 80 -- ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -crf 23 -c:a copy output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment