Skip to content Skip to sidebar Skip to footer

Convert Rtp Payload (payload Type 107, Amr-wb 16khz 1channel) To .wav

I'm working in Python 3.6 under Linux Ubuntu and I used the Scapy lib to extract data from a bin file which contained the following stack: IP/UDP/RTP. The RTP-PAYLOAD TYPE is 107 (

Solution 1:

You need to use a AMR decoder(ffmpeg - libavcodec) to decode the AMR payload data.

AMR decoder will give you PCM data, which can be written to a wav file (16 KHz).

AMR codec library can be used with ctypes python interface - Extending Python With C Libraries.

Solution 2:

Document RFC4867 (can easily found with google), chapters 4.3, 4.4 and 5. First it must be found out, if the RTP-PAYLOAD is bandwidth efficient (chapter 4.3) or octet aligned (4.4). In this case it's bandwidth efficient according 4.3.4. and it must be transformed according chapter 5, 5.1 and 5.3 before writing it into a file.amr or file.awb (both works).

The resulting file can be listened to with VLC-Media player and with 'Videos' of Linux Ubuntu. But it can also be converted into all kinds of audiofiles by the online-converter 'convertio'.

https://convertio.co/it/

A direct way to do that in Python is the Python library ffmpy that has FFmpeg wrapped.

https://ffmpy.readthedocs.io/en/latest/

Under Quickstart there is an' example that resolves the problem.

Post a Comment for "Convert Rtp Payload (payload Type 107, Amr-wb 16khz 1channel) To .wav"