Skip to content

First implementation of FFmpeg filters - #7654

Closed
Nomis101 wants to merge 1 commit into
HandBrake:masterfrom
Nomis101:avfilter-audio-video
Closed

Nomis101 wants to merge 1 commit into
HandBrake:masterfrom
Nomis101:avfilter-audio-video

Conversation

@Nomis101

Copy link
Copy Markdown
Contributor

Adds support for FFmpeg audio and video filters in HandBrake, accessible via CLI options and the preset/job JSON API. This enables a range of audio processing and video enhancement capabilities powered by FFmpeg's libavfilter.

This is a first attempt for bug #1993, working on that for a few month now. As a first step to add FFmpeg filters, I focused solely on HandBrakeCLI. This was a bit complicated, therefore I had some help. I think the most difficult part is incorporating everything into a GUI, which was too complicated for me at this point. Therefore I focused on CLI only. I also focused only on filters that can be implemented without extra dependencies. I mainly implemented audio filters, as HandBrake doesn't have any yet.
What I had to left out is a filter for video stabilization, as this requires a 2-pass procedure. First, a pass that analyzes the video and writes a file, and then a second pass that reads the file and re-encodes the video with this data. What is also not included is the vibrance filter, as it didn't work with HDR.

Included are the following filter:

Video filters:

BM3D denoising
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --bm3d[=string]
(presets: default/medium/strong, or custom params)

Deband (Remove banding artifacts from input video)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --deband[=string]

Equalizer (brightness/contrast/saturation/gamma)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --eq[=string]
(presets: brighten/darken/vivid)

Audio filters (stereowiden, dialoguenhance, crossfeed are stereo input only):

De-click (Remove impulsive noise from input audio)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --adeclick[=string]

De-clip (Remove clipped samples from input audio)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --adeclip[=string]

Compressor (Dynamic range compression)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --acompressor[=string]

Limiter
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --alimiter[=string]

FFT denoiser
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --afftdn[=string]

Non-local means denoiser (Reduce broadband noise)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --anlmdn[=string]

Noise gate
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --agate[=string]

Crossfeed (headphone crossfeed filter, needs stereo input)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --crossfeed[=string]

Dialog enhancement (Enhance dialogue in stereo audio, output is 3.0 audio)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --dialoguenhance[=string]

Surround upmix (audio surround upmix, needs multichannel encoder)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --surround -E ac3

Loudness normalization (EBU R128)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --loudnorm[=string]

Stereowiden (Stereo image widening, needs stereo input)
e.g. HandBrakeCLI -i in.mkv -o out.mkv -e svt_av1_10bit --stereowiden[=string]

  • "Filters that require specific input layouts (stereowiden, crossfeed, dialoguenhance) get explicit aformat constraints". This is handled in the CLI filter string construction so the libhb framework remains generic.
  • "dialoguenhance outputs 3.0, which FFmpeg and most encoders support natively, so I added the missing HB_AMIXDOWN_3POINT0 mixdown

Note: Because of its complexity this is the first time I've used AI assistance (Claude Code). This implementation was developed with assistance from Claude Code for exploring and understanding the relevant codebase, debugging and for helpful tips. I have carefully written the code, ensured they integrate correctly with the existing codebase, and validated the behavior through testing. I tested with several input formats, output formats and filter variations. And I removed parts that turned out to not work (e.g. vibrance filter).

Tested on:

  • Windows 10+ (via MinGW)
  • macOS 10.13+
  • Ubuntu Linux

@Nomis101
Nomis101 marked this pull request as draft February 18, 2026 21:03
@galad87

galad87 commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

It would be better to split each change in a different PR.
One for the additional mixdown, and one for the video filters, which are a smaller change and probably can be easily merged, and another one for the audio filters.

@Nomis101

Copy link
Copy Markdown
Contributor Author

OK, sure. Can work on splitting this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants