Using FFmpeg: Applying Firequalizer Filter to Audio in Video Based on Duration

Abstract: Apply FFmpeg firequalizer to specific video segments using atrim, asetpts, and concat filters.

Created: 2026-09-21 by

Use the atrim and asetpts audio filters combined with concat to apply the firequalizer filter selectively. This method splits the audio stream into segments, applies the equalization to specific time ranges, and recombines them without invalid crossfade logic or multiple input errors.

Understanding the Segment-Based Approach

When you need to modify audio characteristics for only a portion of a video file, applying a global filter affects the entire duration. The Firequalizer filter is powerful but operates on the entire stream by default. To restrict its effect to specific intervals, such as the first thirty seconds of a clip, you must manipulate the timeline at the audio level before rejoining it with the visual track. This technique relies on splitting the audio source into distinct parts. You create one segment that contains the unmodified audio for the later part of the video, and another segment that includes the modified audio for the initial period. By processing these segments separately, you ensure that the equalizer settings do not bleed into unwanted sections. This approach is robust because it avoids complex conditional logic within the filter graph that can become unstable or difficult to debug. For users managing large media libraries, understanding how to handle specific segments efficiently is crucial. If you are working with extensive footage, efficient filtering prevents unnecessary encoding overhead. For more information on handling large files, see our guide on stabilizing large videos with Linux Mint and ffmpeg.

Constructing the Filter Graph

The core of this solution involves three main steps: trimming, filtering, and concatenating. First, you identify the exact timecodes where the filter should start and stop. Let us assume you want to apply the firequalizer to the first thirty seconds and leave the rest of the video unchanged. You will use the atrim filter to extract the first thirty seconds of the audio. Simultaneously, you must use asetpts to reset the timestamp of this trimmed segment to zero. This step is critical because the subsequent concat filter requires all inputs to have synchronized starting timestamps. Without resetting the PTS (Presentation Time Stamp), the concatenation will fail or produce silent gaps. Next, you apply the firequalizer filter to this first segment. You can define your desired frequency response curves here. For example, you might boost bass frequencies or cut harsh mid-range tones. The syntax allows you to specify gain values in decibels for specific frequency bands. Then, you process the remainder of the audio. You trim from the thirty-second mark to the end of the stream using atrim=start=30. Again, use asetpts to normalize the timestamps so they align correctly with the visual stream. This second segment remains untouched by the equalizer. Finally, you join these two processed streams back together. The concat filter takes the filtered first segment and the unfiltered second segment as inputs. It outputs a single continuous audio stream that preserves the original timing relative to the video.

Implementing the Command

Below is the complete command structure. Replace input.mp4 with your source file and adjust the frequency parameters in the firequalizer section to match your audio engineering needs.
ffmpeg -i input.mp4 \
-filter_complex "[0:a]atrim=start=0:end=30,asetpts=PTS-STARTPTS[a1]; [0:a]atrim=start=30,asetpts=PTS-STARTPTS[a2]; [a1]firequalizer=g='frequency^2*0.1'[a1_eq]; [a1_eq][a2]concat=n=2:v=0:a=1[out]" \
-map 0:v -map "[out]" output.mp4
In this command, [0:a] references the audio stream from the first input. The labels [a1] and [a2] represent the trimmed segments. The label [a1_eq] represents the equalized version of the first segment. The concat filter specifies n=2 because there are two input segments, v=0 because we are only concatenating audio, and a=1 because we expect one output audio stream. The -map 0:v flag ensures that the original video stream is copied directly without re-encoding, which saves significant processing time. The -map "[out]" attaches our newly constructed audio stream to the video. If you are dealing with subtitle tracks that also need management during these operations, ensure they remain intact. Our tutorial on setting default subtitle tracks in FFmpeg on Ubuntu provides additional context for managing multi-track media files.

Verifying the Output

After running the command, verify the result by playing the output file. Listen closely to the first thirty seconds to confirm the equalization effect is present. Then, listen to the remainder of the file to ensure the audio quality has returned to its original state without the filter applied. Check the metadata of the output file to ensure the duration matches the input. Sometimes, floating-point inaccuracies in trimming can cause slight discrepancies in length. If you notice a gap or overlap, adjust the end time of the first trim or the start time of the second trim by a small margin, such as 0.01 seconds. For scenarios involving frame capture or device-based streaming, similar precision is required. See our article on capturing frames from FFmpeg video stream with Device B to understand broader stream manipulation techniques.

Frequently Asked Questions

Why does my concat filter fail with an error?

This usually happens because the timestamps of the input segments are not aligned. Ensure you use asetpts=PTS-STARTPTS on every trimmed segment before passing them to concat. This resets their internal clock to zero, allowing seamless joining.

Can I apply different equalizers to different segments?

Yes, you can chain multiple firequalizer filters on different trimmed segments. Simply assign unique labels to each filtered segment and include them all in the concat filter with the correct number of inputs specified by n.

Does this method re-encode the video?

No, if you use -c:v copy or map the video stream directly as shown, the video data is copied bit-for-bit. Only the audio stream is processed and re-encoded, which is much faster than full transcoding.

What if my audio duration is not exactly divisible by 30 seconds?

The atrim filter handles variable lengths gracefully. As long as the start and end points cover the entire audio stream without gaps, the concatenation will work regardless of the total duration.

How do I remove silence between segments?

If trimming introduces tiny gaps, add adelay filters to shift segments slightly, or use the silenceremove filter on individual segments before concatenation to clean up any artifacts.

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