# videochat flash + AEC (Accoustic Echo Cancellation)

**URL:** <https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338>\
**Category:** Wowza Streaming Engine\
**Created:** [October 29, 2010, 7:29am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338 "2010-10-29T07:29:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Damien\_Griessinger](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@Damien\_Griessinger](https://community.wowza.com/u/Damien_Griessinger)\
**Post date:** [October 29, 2010, 7:29am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/1 "2010-10-29T07:29:48Z")

</div>

Hi everybody,

I’m looking to implement AEC in videochat application, it seems that it’s not possible directly in flash client, but maybe it’s possible to do that on the wowza server itself ?

Anybody have an idea ? How can I change voice stream on fly on server ?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [October 29, 2010, 4:34am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/2 "2010-10-29T04:34:07Z")

</div>

This package shows how to intercept audio packets from an incoming stream:

[https://www.wowza.com/downloads/forums/videopassthru/VideoPassThru.zip](https://www.wowza.com/downloads/forums/videopassthru/VideoPassThru.zip)

This forum post shows an example of how to use the Publishing API:

[https://www.wowza.com/docs/how-to-use-publisher-api-and-jspeex-to-publish-an-audio-stream-voip-integration](https://www.wowza.com/docs/how-to-use-publisher-api-and-jspeex-to-publish-an-audio-stream-voip-integration))

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [November 3, 2010, 3:51am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/3 "2010-11-03T03:51:48Z")

</div>

The idea is you use the video pass thru hooks to grab the incoming stream and the publisher api to create a new stream with the echo gone. We do not have an exact forumal or suggest path for this type of integration. These are the two ends of the solution. The video pass thru for grabbing the incoming stream and the publisher API for publishing a new stream with raw frames. There is a lot left to the reader.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 16, 2011, 5:19am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/4 "2011-02-16T05:19:00Z")

</div>

Try chaning packet.getTimecode() to packet.getTimecodeAbs().

Charlie

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 22, 2011, 1:28pm UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/5 "2011-03-22T13:28:00Z")

</div>

Geofflee posted a couple of options here:

[https://www.wowza.com/forums/showthread.php?12024-Filtering-RTMP-audio-packets-through-third-party-AEC#10](https://www.wowza.com/forums/showthread.php?12024-Filtering-RTMP-audio-packets-through-third-party-AEC#10)

Flash community is waiting for years for AEC to be built into the plug-in.

Richard

---

<div class="post-metadata">

**Author:** ![Marcel\_Rouwenhorst](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Marcel\_Rouwenhorst](https://community.wowza.com/u/Marcel_Rouwenhorst)\
**Post date:** [March 22, 2011, 11:08am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/6 "2011-03-22T11:08:49Z")

</div>

In order to implement echo cancellation I am currently trying to integrate the Speex library with Wowza, following the suggestions I found in this forum.

Has anyone succeeded and maybe willing to share ideas or the source code? That would be highly appreciated.

Waiting for the new flash client (10.3) is not an option…

---

<div class="post-metadata">

**Author:** ![Damien\_Griessinger](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@Damien\_Griessinger](https://community.wowza.com/u/Damien_Griessinger)\
**Post date:** [November 3, 2010, 9:51am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/7 "2010-11-03T09:51:52Z")

</div>

Thanks Charlie,

I see the idea, but how can I get the live streaming ? in the example, it’s a file on the computer, not live stream.

Connect

||

V

Getting Live Stream

||

V

Process AEC

||

V

Reinject stream

||

V

Sending stream to other client

Dam’s

---

<div class="post-metadata">

**Author:** ![Justin\_Dalton](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@Justin\_Dalton](https://community.wowza.com/u/Justin_Dalton)\
**Post date:** [February 22, 2011, 1:32pm UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/8 "2011-02-22T13:32:34Z")

</div>

Are there any suggestions as to a library or software package that could handle the echo cancellation?

---

<div class="post-metadata">

**Author:** ![Shah\_Rahman](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Shah\_Rahman](https://community.wowza.com/u/Shah_Rahman)\
**Post date:** [February 16, 2011, 4:54am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/9 "2011-02-16T04:54:04Z")

</div>

I have a problem related to this: when republishing a live stream to flash clients with an arrangement similar to the one described above by dgriessinger, I can successfully republish the video, but the audio (speex encoded) is completely nonsense (i.e. silence or short bursts of static). The original stream is still available and has correct contents. The only change on the client side is to change the name of the stream from the republished stream to the original stream. The audio packets do not seem to work with anything I have tried, including resending without alteration and reconstructing the packet from components [publisher.addAudioData(packet.getData(), packet.getTimecode())]. No changes were made to the encoded data for these tests, and packet sniffing shows that the packets are arriving at the client in a way that looks correct (packet data prefixed with 0xb2 speex header byte…) but there is still no sensible audio. Anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![Shah\_Rahman](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Shah\_Rahman](https://community.wowza.com/u/Shah_Rahman)\
**Post date:** [February 16, 2011, 10:50pm UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/10 "2011-02-16T22:50:00Z")

</div>

It worked, thanks. The method was packet.getAbsTimecode()… apparently the flash client thought those packets were maybe from the early 1970s and thought “ewwww, disco” or something.

---

<div class="post-metadata">

**Author:** ![Kapil\_Khandal](https://avatars.discourse-cdn.com/v4/letter/k/dec6dc/32.png) [@Kapil\_Khandal](https://community.wowza.com/u/Kapil_Khandal)\
**Post date:** [April 10, 2013, 9:58am UTC](https://community.wowza.com/t/videochat-flash-aec-accoustic-echo-cancellation/34338/11 "2013-04-10T09:58:16Z")

</div>

> It worked, thanks. The method was packet.getAbsTimecode()… apparently the flash client thought those packets were maybe from the early 1970s and thought “ewwww, disco” or something.

Can you please share your code for this same ?

We need a solution which can work at server side. Because still flash not have the option to manage the AEC on mobile devices.

Thanks,

Kind Regards,

Kapil
