FFmpeg: Hide Banner for Specific Y-Position in MP4 with Quality, Size, and Frame Rate

Abstract: Remove a static banner from an MP4 video at a specific Y-position using FFmpeg cropping and scaling while maintaining custom quality, size, and frame rate.

Created: 2026-08-22 by

To hide a banner at a specific Y-position in an MP4 video while maintaining custom quality, size, and frame rate settings, use FFmpeg’s drawtext or overlay filters combined with geometric transformations. The most robust method involves cropping the video area below the banner, scaling to the desired resolution, and re-encoding with precise parameters for bitrate and frame rate.

Understanding the Geometry of Banner Removal

Before applying any filters, you must determine the exact pixel coordinates where the banner resides. Most digital videos have a standard aspect ratio, but banners often span the full width at either the top (positive Y) or bottom (negative Y relative to the end). If your goal is to remove a static graphic overlay that was burned into the video file, simple cropping is the most efficient approach because it does not require complex content-aware fill algorithms which are computationally expensive and often produce artifacts. The key variable here is the height of the banner. You need to know how many pixels from the top or bottom edge constitute the "banner zone." For example, if your video is 1080p high and the banner occupies the top 50 pixels, you will crop the top 50 pixels off. This reduces the total height of the video frame. Understanding this geometry is crucial before moving to scaling, as scaling happens after cropping to ensure the final output dimensions match your target size exactly. For more complex scenarios where you might want to manipulate frames differently, such as removing specific intervals to smooth out playback, you can refer to guides on How to Delete Every 25th Frame in FFMPEG for Smoother Video Playback. While this technique removes temporal redundancy rather than spatial elements, it highlights FFmpeg's flexibility in frame manipulation.

Cropping the Video Stream

The first step in the pipeline is to remove the unwanted visual data using the crop filter. This filter takes four arguments: width, height, x-offset, and y-offset. To remove a banner from the top of the video, you keep the original width but reduce the height by the banner's pixel count, setting the y-offset to the height of the banner so that FFmpeg starts capturing frames from below the banner. Assume your source video is 1920x1080 and the banner is 100 pixels tall at the top. The command would look like this:
-vf "crop=1920:980:0:100"
Here, 1920 is the new width, 980 is the new height (1080 - 100), 0 is the horizontal offset (starting from the left edge), and 100 is the vertical offset (skipping the top 100 pixels). If the banner were at the bottom, the y-offset would be 0, and you would subtract the banner height from the total height again, effectively keeping the top portion of the video. This operation is lossless regarding the remaining pixels; no data is lost from the visible area, preserving maximum quality for the subsequent encoding stage. If you need to adjust the timing or synchronization of these operations, understanding how FFmpeg handles timestamps is vital. Incorrect PTS handling can lead to audio desync or stuttering, so consider reading about Incorrect pts filename with ffmpeg's -ss and -frame_pts true to avoid common timestamp pitfalls during complex filter chains.

Scaling to Target Size and Quality

After cropping, the video dimensions have changed. If your requirement specifies a particular output size (e.g., 1280x720), you must apply the scale filter immediately after the crop filter. It is important to maintain the aspect ratio unless the target format requires a specific non-standard dimension. To scale the cropped video to 1280x720, you append the scale filter to your chain:
-vf "crop=1920:980:0:100,scale=1280:720"
Quality control is primarily managed through the video codec and bitrate settings rather than the filter itself. When using H.264 or H.265 codecs, you should specify a constant rate factor (CRF) or a target bitrate. A lower CRF value (e.g., 18-23 for H.264) results in higher quality but larger file sizes. For strict size constraints, calculate the bitrate based on the duration and target file size.
-c:v libx264 -crf 20 -preset medium
This ensures that the visual fidelity remains high even after the geometric transformations. The medium preset offers a balanced trade-off between encoding speed and compression efficiency.

Setting Frame Rate and Final Output

Frame rate consistency is critical for smooth playback. If the source video has a variable frame rate (VFR), it is best practice to convert it to a constant frame rate (CFR) using the fps filter in the video filter chain.
-vf "crop=1920:980:0:100,scale=1280:720,fps=30"
This forces the output to exactly 30 frames per second. Combining this with the previous steps creates a complete processing pipeline. You also need to ensure the audio stream is handled correctly, typically by copying it without re-encoding to save time and preserve audio quality:
-c:a copy
Finally, specify the output format as MP4. Note that some users attempt to concatenate multiple processed clips afterward. If your workflow involves merging several banner-free segments, ensure they share the same codec and parameters to avoid compatibility issues, as detailed in How to Concatenate Videos with FFmpeg. The complete command structure looks like this:
ffmpeg -i input.mp4 -vf "crop=1920:980:0:100,scale=1280:720,fps=30" -c:v libx264 -crf 20 -c:a copy output.mp4
This command crops the top banner, scales to HD, enforces 30 FPS, encodes with high-quality H.264, and copies the audio, resulting in a clean, properly sized MP4 file.

Frequently Asked Questions

Can I blur the banner instead of cropping it?

Yes, you can use the boxblur filter applied to a specific region defined by the select filter or by using the drawrect filter to cover the area. However, blurring leaves black or blurred artifacts where the banner was, whereas cropping physically removes the pixels and allows scaling to fill the space seamlessly.

What if the banner is semi-transparent?

Cropping will still work perfectly fine because it ignores the alpha channel and simply cuts the pixel data. Semi-transparency only matters if you are trying to composite a new background behind the banner, which requires advanced inpainting tools not natively available in standard FFmpeg filters.

Will changing the frame rate cause audio desync?

No, the fps filter only affects the video stream. As long as you use -c:a copy to pass through the original audio stream without modification, the audio timeline remains independent of the video frame rate changes.

How do I find the exact pixel height of my banner?

You can open the video in a media player like VLC and pause on a clear frame. Use the player's screenshot feature or a dedicated image editor to measure the banner's height in pixels. Alternatively, use FFmpeg's vhook or external scripts to analyze the average color change across the vertical axis to detect the banner boundaries automatically.

Is it better to crop or use a mask overlay?

Cropping is superior for reducing file size and simplifying the pipeline because it reduces the number of pixels that need to be encoded. Mask overlays require additional layers and often result in larger files due to the extra data required to encode the transparent or masked regions.

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