[FFmpeg-devel] Adding libspeexdsp's AEC to FFmpeg.

Arseniy Skvortsov ettavolt at gmail.com
Tue Sep 4 10:09:22 EEST 2018


Hello,

I'm trying to add AEC from libspeexdsp to libavfilter.
Target use case: two Android smartphones recording audio, transmitting it  
with RTP to some processor, which cancels echo, adds a delay to sync with  
another video stream, mixes with music and outputs to a stereo system.

First line of the log file attached shows the commandline I use for  
testing. What the filtergraph means: grab mono from USB webcam, pass it as  
'record' to AEC, loopback 'cleaned' output with a frame delay as  
'playback' for AEC, build a stereo output from a 'cleaned' output and a  
channel of silence.
OFFTOPIC: Had to use ALSA directly because pulse demuxer has some weird  
delay problem (https://bbs.archlinux.org/viewtopic.php?id=239893).

So far AEC already does something useful because positive  
self-amplification (or what's the term for this?) starts on a [slightly]  
larger volume then without this filter. ☺
Still, it doesn't remove the effect completely. I suspect, that it may be  
related to warnings
[alsa @ 0x56554d388bc0] ALSA buffer xrun
and FF_FILTER_FORWARD_STATUS_BACK_ALL dropping all queued frames when  
output isn't ready. How do you think, is it true?

I've also explored possibility of adding webrtc-audio-processing's AEC,  
but for that I'd need to build a C/C++ wrapper. Of which I haven't found  
any example in FFmpeg's code. People out there say that it's better than  
libspeexdsp's. Plus Xiph seems to be very insisting on 'one-quartz  
recording & playback', while my use case is definitely nothing like this.  
What do you think about this?

Any suggestions are welcome.

Arseniy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-AEC-filter-from-Speex.patch
Type: application/octet-stream
Size: 12662 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180904/64d90c8c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: speexaec.log
Type: application/octet-stream
Size: 10392 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180904/64d90c8c/attachment-0001.obj>


More information about the ffmpeg-devel mailing list