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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ docs/html/
/janus-cfgconv
/janus-pp-rec
/mjr2pcap
/pcap2mjr
/plugins/*.so
/transports/*.so
/events/*.so
Expand Down Expand Up @@ -53,6 +54,8 @@ Makefile.in
/postprocessing/*.o
/postprocessing/pp-cmdline.c
/postprocessing/pp-cmdline.h
/postprocessing/p2m-cmdline.c
/postprocessing/p2m-cmdline.h
/fuzzers/*.a
/fuzzers/*.o
/fuzzers/out
Expand Down
39 changes: 39 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ endif
if ENABLE_POST_PROCESSING
bin_PROGRAMS += janus-pp-rec
bin_PROGRAMS += mjr2pcap
if ENABLE_PCAP2MJR
bin_PROGRAMS += pcap2mjr
endif

janus_pp_rec_SOURCES = \
postprocessing/pp-cmdline.c \
Expand Down Expand Up @@ -622,8 +625,44 @@ mjr2pcap_LDADD = \
$(POST_PROCESSING_MANUAL_LIBS) \
$(NULL)

if ENABLE_PCAP2MJR
pcap2mjr_SOURCES = \
postprocessing/p2m-cmdline.c \
postprocessing/p2m-cmdline.h \
postprocessing/pp-rtp.h \
postprocessing/pcap2mjr.c \
log.c \
utils.c \
$(NULL)

pcap2mjr_CFLAGS = \
$(AM_CFLAGS) \
$(POST_PROCESSING_CFLAGS) \
$(PCAP_CFLAGS) \
$(NULL)

pcap2mjr_LDADD = \
$(POST_PROCESSING_LIBS) \
$(POST_PROCESSING_MANUAL_LIBS) \
$(PCAP_LIBS) \
$(NULL)

BUILT_SOURCES += postprocessing/p2m-cmdline.c postprocessing/p2m-cmdline.h

postprocessing/p2m-cmdline.h: postprocessing/p2m-cmdline.c

postprocessing/p2m-cmdline.c: postprocessing/pcap2mjr.c
gengetopt --set-package="pcap2mjr" --set-version="$(VERSION)" -F postprocessing/p2m-cmdline < postprocessing/pcap2mjr.ggo

EXTRA_DIST += postprocessing/pcap2mjr.ggo
CLEANFILES += postprocessing/p2m-cmdline.c postprocessing/p2m-cmdline.h
endif

dist_man1_MANS += postprocessing/janus-pp-rec.1
dist_man1_MANS += postprocessing/mjr2pcap.1
if ENABLE_PCAP2MJR
dist_man1_MANS += postprocessing/pcap2mjr.1
endif

endif

Expand Down
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,21 @@ AS_IF([test "x$enable_post_processing" = "xyes"],
])
])

PKG_CHECK_MODULES([PCAP],
[libpcap],
[
AC_DEFINE(HAVE_LIBPCAP)
enable_pcap2mjr=yes
],
[
enable_pcap2mjr=no
])
AC_SUBST([PCAP_CFLAGS])
AC_SUBST([PCAP_LIBS])

AM_CONDITIONAL([WITH_SOURCE_DATE_EPOCH], [test "x$SOURCE_DATE_EPOCH" != "x"])
AM_CONDITIONAL([ENABLE_POST_PROCESSING], [test "x$enable_post_processing" = "xyes"])
AM_CONDITIONAL([ENABLE_PCAP2MJR], [test "x$enable_pcap2mjr" = "xyes"])

AC_CONFIG_FILES([
Makefile
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/mjr2pcap.1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mjr2pcap \- Helper tool to convert a Janus recordings to pcap format.
.IR destination.pcap
.SH DESCRIPTION
.B mjr2pcap
is a simple utility that allows you remove extract RTP packets from Janus recordings and save them to a .pcap file instead. Notice that network levels are simulated, and so are timestamps for when the packets have really been received, since that info is not stored in .mjr files. As such, its main purpose is helping analyze RTP packets, rather than investigate network issues.
is a simple utility that allows you to extract RTP packets from Janus recordings and save them to a .pcap file instead. Notice that network levels are simulated, and so are timestamps for when the packets have really been received, since that info is not stored in .mjr files. As such, its main purpose is helping analyze RTP packets, rather than investigate network issues.
.TP
The tool requires two parameters: the path to the .mjr file to read, and a path to the target .pcap file. Notice that an attempt to process a non-RTP recording will result in an error.
.SH EXAMPLES
Expand Down
46 changes: 46 additions & 0 deletions postprocessing/pcap2mjr.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.TH PCAP2MJR 1
.SH NAME
pcap2mjr \- Helper tool to convert a pcap dump to a Janus recordings.
.SH SYNOPSIS
.B pcap2mjr [options]
.IR source.pcap
.IR destination.mjr
.SH DESCRIPTION
.B pcap2mjr
is a simple utility that allows you take .pcap network captures, extract a specific RTP session via its SSRC, and convert it to an .mjr Janus recording instead. Its main purpose is helping convert .pcap captures to media files, or make it easier to replay them via Janus.
.TP
The tool requires a path to the .pcap file to read, and a path to the target .pcap file; besides, it needs info on the codec and the SSRC to filter. Notice that if the tool can't detect any RTP packet with that SSRC, it will result in an error.
.SH OPTIONS
.TP
.BR \-h ", " \-\-help
Print help and exit
.TP
.BR \-V ", " \-\-version
Print version and exit
.TP
.BR \-c ", " \-\-codec=\fIcodec\fR
Codec the recording will contain (e.g., opus, vp8, etc.)
.TP
.BR \-s ", " \-\-ssrc=\fISSRC (numeric)\fR
SSRC of the packets in the pcap file to save
.TP
.BR \-w ", " \-\-warnings
Show warnings for skipped packets (e.g., not RTP or wrong SSRC)
.SH EXAMPLES
\fBpcap2mjr -c opus -s 12345678 rec1234.pcap rec1234.mjr\fR \- Read all RTP packets with SSRC 12345678 from the provided .pcap file, and save them to a new .mjr file as an Opus recording
.SH BUGS
.TP
If you think you found a bug or want to contribute a feature, you can issue or a pull request on https://github.com/meetecho/janus-gateway/issues.
.TP
Anyway, before doing that make sure you read the documentation at http://janus.conf.meetecho.com/docs/ and that it has not been discussed already at https://groups.google.com/forum/#!forum/meetecho-janus. We only use Github for code issues, and \fBNOT\fR for configuration or usage issues: use the group for that.
.SH SEE ALSO
.TP
https://github.com/meetecho/janus-gateway \- Official repository
.TP
http://janus.conf.meetecho.com \- Demos and documentation
.TP
https://groups.google.com/forum/#!forum/meetecho-janus \- Community
.TP
http://www.meetecho.com/blog/ \- Tutorials and blog posts on Janus
.SH AUTHORS
Lorenzo Miniero ([email protected])
Loading