2

I have got this capture file (pcap) with RTP packets seems to be encoded by opus. In wireshark, analyzed the stream and saved as raw file. Now I have got the .raw file of the audio. Using the opus tool from http://www.opus-codec.org/downloads/ I cannot decode it direct to wav because the file is raw,not .opus. I cannot encode it to .opus because this raw data is the extract of already encoded stream. I just need to play this voice back. Any suggestions Please

Shasi
  • 274
  • 6
  • 21

2 Answers2

1

As far as I know you won't be able to decode Opus stream extracted that way - framing information is lost. You need either write Wireshark module that would be able to decode opus or write another tool to extract stream from RTP into another container (typically OGG is used).

http://xiph.org/~giles/2012/rtpopus.c seems to be tool that you need.

TMSZ
  • 695
  • 4
  • 5
1

Old question, but if anyone needs to decode Opus RTP packets, here is the solution:

PJSIP comes with a tool (pjsip-apps/src/samples/pcaputil.c) that does just that. It gets compiled by default, just make sure you have libopus-dev installed before you build PJSIP. Simply feed a pcap file with RTP packets to pcaputil and specify the codec on the command line (e.g. "opus/48000"). You will get the decoded audio as a PCM WAV file.

pcaputil can also decrypt SRTP packets (if given the key), however I could not get that to work and instead used srtp-decrypt to decrypt the packets, followed by Wireshark to convert the .txt output back to .pcap for feeding to PJSIP's pcaputil (see also https://www.acritelli.com/hacking-voip-decrypting-sdes-protected-srtp-phone-calls/).

neon1
  • 716
  • 5
  • 5