[FFmpeg-user] High audio latency (although low with ffplay!)

Arif Driessen arifd86 at gmail.com
Wed Sep 8 12:44:01 EEST 2021


Hi guys,

I want to have ffmpeg grab my microphone at a high sample rate, apply some
processing, downsample and feed it to a virtual PulseAudio device to then
be able to use live in any application.

But even in the most vanilla setting, it is adding about 4 seconds of
latency:

$ ffmpeg -f alsa -acodec pcm_s32le -i hw:1,0 -f pulse out

Doing this, say in Audacity, introduces no noticeable latency.

Let's try from pulse to pulse:

$ ffmpeg -f pulse -acodec pcm_s16le -i default -f pulse out

Again, 4 seconds latency.

Interestingly, if I use ffplay, there is no noticeable latency!

$ ffplay -f pulse -acodec pcm_s16le -i default

Taking the input from ffmpeg and piping it to ffplay...

$ ffmpeg -f pulse -acodec pcm_s16le -i default -f wav - | ffplay -f wav -

about 3 seconds latency.

I have also experimented with these flags: -thread_queue_size, -fflags
nobuffer, -flags low_delay ,-strict experimental, -re, -deadline realtime

Any ideas?


More information about the ffmpeg-user mailing list