Fork me on GitHub
Macros | Functions | Variables

Simple utility to post-process .mjr files saved by Janus. More...

#include <arpa/inet.h>
#include <endian.h>
#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <jansson.h>
#include "../debug.h"
#include "../version.h"
#include "pp-rtp.h"
#include "pp-webm.h"
#include "pp-h264.h"
#include "pp-opus.h"
#include "pp-g711.h"
#include "pp-g722.h"
#include "pp-srt.h"
Include dependency graph for janus-pp-rec.c:


#define htonll(x)   ((1==htonl(1)) ? (x) : ((gint64)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32))
#define ntohll(x)   ((1==ntohl(1)) ? (x) : ((gint64)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))


int main (int argc, char *argv[])


int janus_log_level = 4
gboolean janus_log_timestamps = FALSE
gboolean janus_log_colors = TRUE

Detailed Description

Simple utility to post-process .mjr files saved by Janus.

Lorenzo Miniero

Our Janus WebRTC gateway provides a simple helper (janus_recorder) to allow plugins to record audio, video and text frames sent by users. At the time of writing, this helper has been integrated in several plugins in Janus. To keep things simple on the Janus side, though, no processing at all is done in the recording step: this means that the recorder actually only dumps the RTP frames it receives to a file in a structured way, so that they can be post-processed later on to extract playable media files. This utility allows you to process those files, in order to get a working media file you can playout with an external player. The tool will generate a .webm if the recording includes VP8 frames, an .opus if the recording includes Opus frames, an .mp4 if the recording includes H.264 frames, and a .wav file if the recording includes G.711 (mu-law or a-law) frames. In case the recording contains text frames as received via data channels, instead, a .srt file will be generated with the text content and the related timing information.

Using the utility is quite simple. Just pass, as arguments to the tool, the path to the .mjr source file you want to post-process, and the path to the destination file, e.g.:

./janus-pp-rec /path/to/source.mjr /path/to/destination.[opus|wav|webm|h264|srt]

An attempt to specify an output format that is not compliant with the recording content (e.g., a .webm for H.264 frames) will result in an error since, again, no transcoding is involved.

You can also just print the internal header of the recording, or parse it without processing it (e.g., for debugging), by invoking the tool in a different way:

./janus-pp-rec --json /path/to/source.mjr
./janus-pp-rec --header /path/to/source.mjr
./janus-pp-rec --parse /path/to/source.mjr
This utility does not do any form of transcoding. It just depacketizes the RTP frames in order to get the payload, and saves the frames in a valid container. Any further post-processing (e.g., muxing audio and video belonging to the same media session in a single .webm file) is up to third-party applications.

Recordings post-processing utility

Macro Definition Documentation

#define htonll (   x)    ((1==htonl(1)) ? (x) : ((gint64)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32))
#define ntohll (   x)    ((1==ntohl(1)) ? (x) : ((gint64)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))

Function Documentation

int main ( int  argc,
char *  argv[] 

Variable Documentation

gboolean janus_log_colors = TRUE
int janus_log_level = 4
gboolean janus_log_timestamps = FALSE