audiopcap

How to collect EVS codec from pcap file


I have several pcap files which captured by wireshark.

I collected this data

I collected that data from pcap file, payload data. and saved it as file. I tried to convert it to pcm data with this link https://github.com/ToughmanL/EVS_CODEC

but it seems the data I collected is not EVS format. please let me know how to get EVS codec from pcap file.


Solution

  • My understanding is that Stack Overflow is for programming questions, so here is an answer based on existing / example source code. First, in your screen cap Wireshark has found a commonly used form of EVS; the 61 byte packet payload length matches the EVS spec for 24400 bps primary mode, using compact format, which means (i) no ToC header byte in the payload, and (ii) only the payload size determines the bitrate. Second, to feed that to the 3GPP decoder you have to create a file with a MIME header and format, which is needed by the 3GPP reference program.

    mediatest_proc.cpp (under the mediaTest folder in the Docker containers here) performs these steps - it reads a pcap record-by-record, pulls out RTP payloads and writes them to a .cod file (coded format), including the MIME header. Running the 3GPP program on that file, with appropriate command line options then gives a PCM raw audio file you can convert to wav using sox, Audacity, Hypersignal, etc.

    In mediaTest_proc.cpp, look for "if (pcap_extract) {". Also note the comment "If pcap RTP payloads are in CH (Compact Header) format, they are converted to FH (Header-Full) format by adding a ToC payload header byte". Which may explain why in your case, if you directly copied the compact header format payloads and fed them to the 3GPP decoder, it didn't work.

    There is also a mediaMin program that will take the pcap on the command line and do the whole thing, generating a .wav file. You can use that for comparison and audio quality testing vs your code.

    Disclaimer: I work for the company that created the mediaTest and mediaMin tools