Opened 2 years ago

Closed 2 years ago

Last modified 2 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


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 and Audacity defaults to using this idiom ( 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 If it's used as such:

  ffmpeg -i in.aac -af "ladspa=file=/usr/local/lib/ladspa/|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:

I think 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, 2 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, 2 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, 2 years ago

Keywords: filter removed

comment:4 by Carl Eugen Hoyos, 2 years ago

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

comment:5 by Laurence Tratt, 2 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.