Skip to content

Fix: Custom audio filters and loudnorm do not work with ffmpeg enabled#150

Merged
tatsumoto-ren merged 1 commit intoAjatt-Tools:masterfrom
carpelli:ffmpeg-filter-bug
Sep 21, 2025
Merged

Fix: Custom audio filters and loudnorm do not work with ffmpeg enabled#150
tatsumoto-ren merged 1 commit intoAjatt-Tools:masterfrom
carpelli:ffmpeg-filter-bug

Conversation

@carpelli
Copy link
Copy Markdown
Contributor

Fixes a bug in the ffmpeg filter processing where filter options are never actually passed to to the ffmpeg command. As a consequence, both user-provided filters and the loudnorm processing did not work.

The bug is caused by code that seems to assume reference semantics for strings, whereas Lua strings are immutable:

ffmpeg.append_user_audio_args = function(args)
local new_args = {}
local filters = ''
separate_filters(filters, new_args, args)
if self.config.tie_volumes then
add_filter(filters, string.format("volume=%.1f", mp.get_property_native('volume') / 100.0))
end
local user_args = {}
for arg in string.gmatch(self.config.ffmpeg_audio_args, "%S+") do
table.insert(user_args, arg)
end
separate_filters(filters, new_args, user_args)
if #filters > 0 then
table.insert(new_args, '-af')
table.insert(new_args, filters)
end
return new_args
end

Note that the filters string is not updated and remains empty.

Fix a bug in the ffmpeg filter processing where the `filters` string was
never actually updated and remained empty (lua strings are immutable).
@tatsumoto-ren
Copy link
Copy Markdown
Member

Makes sense, thanks.

@tatsumoto-ren tatsumoto-ren merged commit 2558235 into Ajatt-Tools:master Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants