Gsk
Gsk

Reputation: 2955

Convert an audio file into a pcap with codec G722

I need to convert an audio file (any common format) into a rtp stream saved in a .pcap file with G.722 Codec.

The generated .pcap file will be sent with SIPp using:

<exec play_pcap_audio="g722.pcap"/>

I know it is possible to send also .wav file with the following command, if the .wav is correctly encoded:

<exec rtp_stream="g711.wav"/>

But seems that is not possible to encode a .wav with G722.

There are multiple solutions on the web and SO on how to convert a .pcap into an audio file, but I'm actually looking for the opposite.

Upvotes: 1

Views: 3610

Answers (2)

TMSZ
TMSZ

Reputation: 687

Get softphone supporting wav files as source and G.722 codec, make call with only G.722 enabled, capture RTP stream to pcap.

Upvotes: 1

Kozyr
Kozyr

Reputation: 301

Steps to convert wav audio to .pcap file:

  1. Split audio to 20 ms chunks
  2. Encode each chunk with G.722 encoder
  3. Create RTP header for each encoded chunk
  4. Save RTP stream to .pcap

I've never used SIPp, but if it can process encoded G.722 stream, then use ffmpeg for encoding:

ffmpeg -i sample.wav -ar 16000 -acodec g722 sample.g722

Upvotes: 1

Related Questions