Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decode Opus-48 using Wireshark

Tags:

wireshark

opus

I want to capture and decode VoIP conversation using Opus-48 codecs. I am using Wireshark to capture packets. Are there any free decoders available online ?? Wireshark doesn't save two way conversation as it works for other encoding schemes like G-729.

like image 878
user3640612 Avatar asked Oct 17 '25 18:10

user3640612


2 Answers

Decode opus RTP pcap using python script here https://github.com/kamanashisroy/opus_stream_tool

Once we have the pcap, we can select an UDP packet in the stream and filter that out either by udp.srcport/udp.dstport or by rtp.ssrc.

Now, we can convert the pcap file into a hex-dump.

tshark -x -r in.pcap -Y "udp.srcport == myport" | cut -d " " -f 1-20 > tmp.txt

Finally we can use the hex_to_opus tool to record ogg encoded opus file.

hex_to_opus.py -x tmp.txt --recordfile out.opus --rtpoffset 42

Normally if it is IPv4 the rtp-offset is 42. Please find the start of the udp payload from the wireshark description of the packet.

like image 106
KRoy Avatar answered Oct 22 '25 03:10

KRoy


You have two choices. Either use the libopus library directly, or else convert your RTP packets into an Ogg Opus files, and then use any player that supports Opus (Firefox, Chrome, VLC, ...) to play the Ogg file. In all cases, you should start at http://opus-codec.org/

like image 22
Jean-Marc Valin Avatar answered Oct 22 '25 05:10

Jean-Marc Valin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!