Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new tool to convert .pcap captures to .mjr recording #2144

Merged
merged 6 commits into from
May 7, 2020
Merged

Conversation

lminiero
Copy link
Member

@lminiero lminiero commented May 6, 2020

What the title says. It's basically the reverse of the mjr2pcap we added in #1718, that I implemented since I needed it for some internal use cases, but can actually be useful in other scenarios as well. It depends on libpcap, so if the library is unavailable the tool will not be built. It's currently hardcoded to IPv4/UDP parsing, so if the pcap capture contains something else (e.g., RTP packet on IPv6) at the moment those packets will simply be ignored. In the future we can make it more flexible, but for the time being this should cover most of the typical captures.

Unlike mjr2pcap, pcap2mjr expects two additional command line arguments:

  1. the codec to write in the .mjr header (e.g., opus)
  2. the SSRC to filter (since a .pcap file may contain several RTP sessions and we only need one)

Example:

pcap2mjr -c opus -s 12345678 file.pcap file.mjr

Planning to merge soon, so feedback welcome.

@lminiero
Copy link
Member Author

lminiero commented May 7, 2020

Added basic support to IPv6 and Linux Cooked Captures. This feels complete to me, so I'll merge.

@lminiero lminiero merged commit f4ce3aa into master May 7, 2020
@lminiero lminiero deleted the pcap2mjr branch May 7, 2020 09:09
@zyliu1985
Copy link

How to build the pcap2mjr tool? I have installed the libpcap and enabled post-processing, but there is no pcap2mjr geneated. There are only janus-pp-rec and mjr2pcap. Thank you.

`./configure --prefix=/opt/janus --disable-rabbitmq --disable-mqtt --enable-post-processing --disable-websockets --enable-pcap2mjr

checking for EVENTS... yes
checking for LOGGERS... yes
checking for npm... no
checking for POST_PROCESSING... yes
checking for PCAP... no
`

@lminiero
Copy link
Member Author

You need libpcap-dev(el). The log clearly says it can't find PCAP, so that's the cause.

@zyliu1985
Copy link

Thanks for your answer. But I'm sure I have installed libpcap-dev by apt.

apt install libpcap-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpcap-dev is already the newest version (1.8.1-6ubuntu1.18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

How can I check the libpcap is working correctly?
I wrote a lillte test code, it seems that libpcap is working.

#include <pcap.h> #include <stdio.h> int main() { char errBuf[PCAP_ERRBUF_SIZE], * device; device = pcap_lookupdev(errBuf); if(device) { printf("success: device: %s\n", device); } else { printf("error: %s\n", errBuf); } return 0; }

output:

./test

success: device: docker0

Thank you.

@zyliu1985
Copy link

I compiled and installed the libpcap by code. And the pkg checked is passed. And pcap2mjr is ok.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants