Skip to content

Commit 2558235

Browse files
authored
Fix filter processing with ffmpeg (#150)
Fix a bug in the ffmpeg filter processing where the `filters` string was never actually updated and remained empty (lua strings are immutable).
1 parent 86ab104 commit 2558235

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

encoder/encoder.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ end
248248

249249
local function add_filter(filters, filter)
250250
if #filters == 0 then
251-
filters = filter
251+
return filter
252252
else
253-
filters = string.format('%s,%s', filters, filter)
253+
return string.format('%s,%s', filters, filter)
254254
end
255255
end
256256

@@ -267,29 +267,30 @@ local function separate_filters(filters, new_args, args)
267267
expect_filter = true
268268
else
269269
if expect_filter then
270-
add_filter(filters, args[i])
270+
filters = add_filter(filters, args[i])
271271
else
272272
table.insert(new_args, args[i])
273273
end
274274
expect_filter = false
275275
end
276276
end
277+
return filters
277278
end
278279

279280
ffmpeg.append_user_audio_args = function(args)
280281
local new_args = {}
281282
local filters = ''
282283

283-
separate_filters(filters, new_args, args)
284+
filters = separate_filters(filters, new_args, args)
284285
if self.config.tie_volumes then
285-
add_filter(filters, string.format("volume=%.1f", mp.get_property_native('volume') / 100.0))
286+
filters = add_filter(filters, string.format("volume=%.1f", mp.get_property_native('volume') / 100.0))
286287
end
287288

288289
local user_args = {}
289290
for arg in string.gmatch(self.config.ffmpeg_audio_args, "%S+") do
290291
table.insert(user_args, arg)
291292
end
292-
separate_filters(filters, new_args, user_args)
293+
filters = separate_filters(filters, new_args, user_args)
293294

294295
if #filters > 0 then
295296
table.insert(new_args, '-af')
@@ -578,7 +579,6 @@ local create_static_snapshot = function(timestamp, source_path, output_path, on_
578579
local args = { 'screenshot-to-file', output_path, 'video', }
579580
mp.command_native_async(args, on_finish_fn)
580581
end
581-
582582
end
583583

584584
local report_creation_result = function(file_path, on_finish_fn)

0 commit comments

Comments
 (0)