Warm tip: This article is reproduced from serverfault.com, please click

How to remove noise added when converting pcma/aluw file I received in RTP to wav?

发布于 2021-01-12 09:10:25

This is the sdp:

v=0
o=root 807151903 807151903 IN IP4 104.154.78.142
s=Asterisk PBX 11.18.0
c=IN IP4 104.154.78.142
t=0 0
m=audio 13822 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

I'm taking all the payloads and combine them to one file using rdp-parser.

var b = p.parseRtpPacket(msg)
fs.appendFileSync("./b", b.payload)

I also tried other RTP parse libraries to be sure it's not the issue with the parser.

Then I'm running ffmpeg:

ffmpeg -f mulaw -ar 8000 -i b  a.wav

Now I'm playing the file. I'm hearing my voice, and lot of noise in the background. Why? and how to fix it?

Questioner
Shluch
Viewed
0
Aminadav Glickshtein 2021-01-12 17:20:27

You should use the -alaw format instead. And it will work for you.