Scale Video to 4K Using FFmpeg Neighbor Algorithm

Upscaling lower-resolution videos to 4K while maintaining sharp, pixel-perfect details is a common requirement for retro game footage, pixel art, and screencasts. This article provides a straightforward guide on how to use FFmpeg and the neighbor (nearest neighbor) scaling algorithm to upscale your videos to 4K (3840x2160) resolution without introducing unwanted blur or interpolation artifacts.

To upscale a video to 4K using the nearest neighbor algorithm in FFmpeg, you must use the video filter (-vf) argument, specify the target resolution, and set the scaling flag to neighbor.

The FFmpeg Command

Run the following command in your terminal or command prompt:

ffmpeg -i input.mp4 -vf "scale=3840:2160:flags=neighbor" -c:a copy output.mp4

Command Breakdown

Maintaining the Aspect Ratio

If your input video is not in a standard 16:9 aspect ratio, forcing it to 3840x2160 will stretch the image. To maintain the original aspect ratio while scaling to a 4K width, use -1 for the height parameter:

ffmpeg -i input.mp4 -vf "scale=3840:-1:flags=neighbor" -c:a copy output.mp4

FFmpeg will automatically calculate the correct height relative to the 3840-pixel width, keeping the output crisp and perfectly proportioned.