Opened 4 years ago

Closed 4 years ago

#7616 closed enhancement (fixed)

Add latency compensation option to af_ladspa and af_lv2

Reported by: Thomas Mundt Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Some audio plug-ins need to delay the audio, e.g. for look-ahead processing. It would be great to have a user option in af_ladspa and af_lv2 that allows latency compensation by entering the delay in seconds (floating point) and/or in fixed samples.

Change History (9)

comment:1 by Elon Musk, 4 years ago

This is very unclear, please specify which stuff should be used from ladspa/lv2 to make this ticket valid.

comment:2 by Thomas Mundt, 4 years ago

Sorry, I´m not sure I understand you.
As an example: When using the Loudmax ladspa plug-in [] within ffmpeg the audio will be delayed by 1.25 ms due to the look-ahead buffer inside the plug-in. This ticket is about a new option in af_ladspa that I can set to 1.25ms and the audio samples supplied to the Loudmax plugin will be time compensated to eleminate this delay.

comment:3 by Elon Musk, 4 years ago

If you just want to delay audio by certain amount use adelay filter before ladspa/lv2 no need to duplicate such functionality into those 2 filters.

comment:4 by Thomas Mundt, 4 years ago

I need negative delay for compensating the delay of the plug-in.
adelay doesn´t accept negative numbers. I could change this ticket to: Allow negative delay with af_adelay. Would that be better?

Last edited 4 years ago by Thomas Mundt (previous) (diff)

comment:5 by Elon Musk, 4 years ago

So you actually want atrim filter, to trim extra samples at beginning?

comment:6 by Thomas Mundt, 4 years ago

Yes, that might work.
I would put atrim behind ladspa in the filter chain.

The plug-in adds some extra samples at the end due to the internal delay. Will these samples be preserved or are they cut off and replaced by zeroes?

comment:7 by Elon Musk, 4 years ago

For that use also apad filter before ladspa filter. You can not specify duration in seconds but in samples, but I can write patch to fix that.

comment:8 by Thomas Mundt, 4 years ago

Works perfect. Thanks a lot!
For my use case I can easily calculate the number of samples, but in general it may be useful to be able to specify the duration in seconds.

comment:9 by Elon Musk, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.