Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8751 closed enhancement (fixed)

LADSPA latency compensation

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

Description

A common idiom for LADSPA plugins is for them to report their latency with a "latency" output control port which the invoking program can use to correct the output. For example, sox has "ladspa -l" (see https://sourceforge.net/p/sox/patches/101/) and Audacity defaults to using this idiom (https://manual.audacityteam.org/man/effect_menu_ladspa.html). ffmpeg doesn't seem to do this automatically (which is fair enough, as it's not a guaranteed standard), but doesn't seem to have any way to do it optionally, nor any way?

For example, consider the noise-gate plugin https://github.com/feuerbach/noise-gate. If it's used as such:

  ffmpeg -i in.aac -af "ladspa=file=/usr/local/lib/ladspa/ng.so:p=noise_gate:c=c0=-35|c1=1500|c2=150|c3=50" -c:a aac -y out.aac

then 'out.aac' will be both substantially delayed relative to 'in.aac' as well as having the input cut off. You can see the noise-gate plugin defining the output port here for example:

https://github.com/feuerbach/noise-gate/blob/master/ng.cpp#L246

I think https://trac.ffmpeg.org/ticket/7616 is related to this issue, although the report there isn't clear about how common this idiom is.

Change History (5)

comment:1 by Elon Musk, 4 years ago

Resolution: invalid
Status: newclosed

You are misinformed.

FFmpeg reports latency with verbose log output enabled since long time.

comment:2 by Laurence Tratt, 4 years ago

The logging is very helpful, but unless I'm missing something else obvious, FFmpeg has no way of automatically applying the latency compensation as Sox and Audacity can. For example, with the noisegate, I have to run it, check what the latency was, and rerun it with apad and atrim manually (and hope that the latency hasn't changed). For backwards compatibility, the latency compensation almost certainly couldn't be applied in all cases, but (like Sox with its -l switch) it could be an option?

comment:3 by Carl Eugen Hoyos, 4 years ago

Keywords: filter removed

comment:4 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavfilter
Priority: normalwish
Resolution: invalidfixed
Version: unspecifiedgit-master

comment:5 by Laurence Tratt, 4 years ago

This works perfectly -- thanks for not only looking into this so quickly but addressing the issue so quickly!

Note: See TracTickets for help on using tickets.