Tried Resizing Video with FFmpeg, Got Different Strange Resolution? Try Crop

Abstract: Resolve FFmpeg scaling artifacts and incorrect resolutions by using the crop filter to remove black bars and preserve pixel integrity.

Created: 2026-08-23 by
Using the crop filter in FFmpeg resolves strange resolution issues caused by non-standard aspect ratios or black bars. This approach preserves pixel integrity without introducing scaling artifacts, ensuring the output video maintains exact dimensions and clarity.

Understanding Resolution Artifacts

When users attempt to resize videos using standard scaling filters like scale, they often encounter unexpected results such as stretched pixels, incorrect aspect ratios, or resolutions that do not divide evenly by common block sizes (like 16 or 32). This happens because simple resizing forces the video into a new container shape, which can distort circular objects into ellipses or introduce blurry edges if the source frame size is not compatible with the target codec requirements.

The core problem is usually that the source video contains letterboxing (black bars) or pillarboxing, and the user wants to remove these areas rather than stretch them. Alternatively, the user might want to change the aspect ratio from wide to square without distorting the central subject. In these cases, simply changing the width and height parameters fails because it does not account for the spatial distribution of the image data. The solution lies in cropping the input stream before any other processing occurs, allowing you to select exactly which portion of the frame becomes the new active area.

Why Scaling Fails for Specific Use Cases

Scaling operations are geometric transformations that map every pixel from the source coordinate system to the destination coordinate system. If your source is 1920x1080 and you scale to 1280x720, the math works perfectly. However, if you have a 1920x1080 video with 100px black bars on top and bottom, and you try to "resize" to remove them by setting the height to 880, FFmpeg will attempt to fit the entire 1080px height into 880px, resulting in a squashed image. It cannot magically know to ignore the black bars unless you explicitly define a region of interest.

This is where the crop filter differs fundamentally from scale. The crop filter does not resample pixels; it discards them. It extracts a rectangular subset of the input frame. This process is lossless regarding the remaining pixels, meaning no interpolation errors or blurring are introduced. For technical workflows requiring precise metadata or clean cuts for further processing, this distinction is critical.

Syntax of the Crop Filter

The syntax for the crop filter is straightforward but requires understanding four key parameters: width, height, x-offset, and y-offset. The general structure appears within the filter chain as follows:

-vf "crop=out_w:out_h:x:y"

Here is the breakdown of each component:

  • out_w: The desired width of the output frame.
  • out_h: The desired height of the output frame.
  • x: The horizontal offset from the left edge of the input frame. Positive values move right; negative values move left.
  • y: The vertical offset from the top edge of the input frame. Positive values move down; negative values move up.

FFmpeg provides special variables to make dynamic cropping easier. iw represents the input width, and ih represents the input height. Using these allows you to write commands that adapt to different source files automatically. For example, to crop the center half of the video, you would use iw/2:ih/2:(iw-iw/2)/2:(ih-ih/2)/2.

Step-by-Step Implementation Guide

To fix your resolution issue, follow these steps to implement the crop filter correctly. Ensure you are using a recent version of FFmpeg, as older versions may have limited expression support.

  1. Identify the Source Dimensions: Run ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 input.mp4 to get the exact width and height of your problematic file.
  2. Determine the Desired Output Size: Decide what width and height you need. If you want to remove 50 pixels from the top and bottom, calculate the new height as input_height - 100.
  3. Calculate Offsets: If you want the result to be centered, the x-offset is (input_width - output_width) / 2 and the y-offset is (input_height - output_height) / 2.
  4. Construct the Command: Combine these into the command line. For example, to crop a 1920x1080 video to 1920x800 centered vertically:
ffmpeg -i input.mp4 -vf "crop=1920:800:0:140" -c:a copy output.mp4

In this example, the calculation for y is (1080 - 800) / 2 = 140. The x is 0 because we are keeping the full width. The -c:a copy flag ensures audio is remuxed without re-encoding, speeding up the process.

Advanced Dynamic Cropping

For more complex scenarios, such as maintaining a specific aspect ratio while maximizing the content, you can use expressions directly in the filter string. A common pattern is to keep the full width but adjust the height to match a 16:9 or 4:3 ratio relative to the width.

ffmpeg -i input.mp4 -vf "crop=min(iw\,ih*16/9):min(iw*9/16\,ih):(iw-min(iw\,ih*16/9))/2:(ih-min(iw*9/16\,ih))/2" output.mp4

This command dynamically calculates the largest possible rectangle that fits the 16:9 aspect ratio within the original frame, centered perfectly. It prevents the "strange resolution" error by ensuring the output dimensions are always mathematically consistent with the chosen aspect ratio.

If you are dealing with multiple files or integrating this into a larger pipeline, you might also find it useful to look at how to Encode Images and Videos to Make Them Available with FFmpeg for batch processing contexts. Additionally, if your cropping leads to concatenation issues later, refer to our guide on Fixing "Can't Concatenate Videos" Error in FFmpeg to ensure segment compatibility.

Verifying the Result

After running the command, verify the output using ffprobe again. Check that the width and height match your expectations and that the aspect ratio is correct. If the video still appears distorted, double-check that you did not accidentally apply a scale filter after the crop filter, which would undo the benefits of the crop operation. Always place crop before scale in the filter graph if both are needed.

Frequently Asked Questions

Why does my cropped video have black bars added instead of removed?

This usually happens if you apply a scale filter after the crop filter with incompatible dimensions. To prevent this, ensure the crop filter is the first in the chain or remove the scale filter entirely if the cropped dimensions meet your requirements. Also, check that your output container supports the specific resolution without padding.

Can I use crop to rotate a video?

No, the crop filter only selects a rectangular region. It does not change the orientation of the pixels. To rotate a video, you must use the transpose filter (transpose=1 or transpose=2) in combination with crop if you need to remove black bars created by the rotation.

What is the difference between iw and ow in expressions?

iw refers to the input width, while ow refers to the output width. When defining the crop filter, you primarily use iw and ih to reference the source frame dimensions. Using ow inside the crop expression can lead to recursive definition errors because the output width is being calculated simultaneously.

Does cropping reduce the file size?

Cropping reduces the number of pixels processed, which generally lowers the bitrate required for encoding, thus reducing file size. However, the raw removal of frames does not compress data; the reduction comes from the subsequent encoding step needing less data to represent the smaller frame area.

How do I crop to a specific corner?

To crop the bottom-right corner, set the x-offset to iw-out_w and the y-offset to ih-out_h. For example, to take the bottom-right 50% of a 1920x1080 video, use crop=960:540:960:540. This starts the selection at the midpoint horizontally and vertically.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More