Fork me on GitHub
Data Structures | Macros | Typedefs | Functions | Variables

Simple utility to post-process .mjr Recordings 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-cmdline.h"
#include "pp-rtp.h"
#include "pp-webm.h"
#include "pp-h264.h"
#include "pp-av1.h"
#include "pp-h265.h"
#include "pp-opus.h"
#include "pp-g711.h"
#include "pp-g722.h"
#include "pp-srt.h"
#include "pp-binary.h"
Include dependency graph for janus-pp-rec.c:

Data Structures

struct  janus_pp_rtp_skew_context
 

Macros

#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))
 
#define SKEW_DETECTION_WAIT_TIME_SECS   10
 
#define DEFAULT_AUDIO_SKEW_TH   0
 
#define DEFAULT_SILENCE_DISTANCE   100
 
#define DEFAULT_RESTAMP_MULTIPLIER   0
 
#define DEFAULT_RESTAMP_MIN_TH   500
 
#define DEFAULT_RESTAMP_PACKETS   10
 

Typedefs

typedef struct janus_pp_rtp_skew_context janus_pp_rtp_skew_context
 

Functions

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

Variables

int janus_log_level = 4
 
gboolean janus_log_timestamps = FALSE
 
gboolean janus_log_colors = TRUE
 
char * janus_log_global_prefix = NULL
 
int lock_debug = 0
 
gboolean janus_faststart = FALSE
 

Detailed Description

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

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

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

For a more complete overview of the available command line settings, launch the tool with no arguments or by passing –help and it will show something like this:

Usage: janus-pp-rec [OPTIONS] source.mjr [destination.[opus|wav|webm|mp4|srt]]

  -h, --help                    Print help and exit
  -V, --version                 Print version and exit
  -j, --json                    Only print JSON header  (default=off)
  -H, --header                  Only parse .mjr header  (default=off)
  -p, --parse                   Only parse and re-order packets  (default=off)
  -m, --metadata=metadata       Save this metadata string in the target file
  -i, --ignore-first=count      Number of first packets to ignore when
                                  processing, e.g., in case they're cause of
                                  issues (default=0)
  -a, --audiolevel-ext=id       ID of the audio-levels RTP extension
                                  (default=none)
  -v, --videoorient-ext=id      ID of the video-orientation RTP extension
                                  (default=none)
  -d, --debug-level=1-7         Debug/logging level (0=disable debugging,
                                  7=maximum debug level; default=4)
  -D, --debug-timestamps        Enable debug/logging timestamps  (default=off)
  -o, --disable-colors          Disable color in the logging  (default=off)
  -f, --format=STRING           Specifies the output format (overrides the
                                  format from the destination)  (possible
                                  values="opus", "wav", "webm", "mp4",
                                  "srt")
  -t, --faststart               For mp4 files write the MOOV atom at the head
                                  of the file  (default=off)
  -S, --audioskew=milliseconds  Time threshold to trigger an audio skew
                                  compensation, disabled if 0 (default=0)
  -C, --silence-distance=count  RTP packets distance used to detect RTP silence
                                                                  suppression, disabled if 0 (default=100)
  -r, --restamp=count           If the latency of a packet is bigger than the
                                  `moving_average_latency * (<restamp>/1000)`
                                  the timestamps will be corrected, disabled if
                                  0 (default=0)
  -c, --restamp-packets=count   Number of packets used for calculating moving

                                  average latency for timestamp correction
                                  (default=10)
  -n, --restamp-min-th=milliseconds
                                Minimum latency of moving average to reach
                                  before starting to correct timestamps.
                                  (default=500)
Note
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

◆ DEFAULT_AUDIO_SKEW_TH

#define DEFAULT_AUDIO_SKEW_TH   0

◆ DEFAULT_RESTAMP_MIN_TH

#define DEFAULT_RESTAMP_MIN_TH   500

◆ DEFAULT_RESTAMP_MULTIPLIER

#define DEFAULT_RESTAMP_MULTIPLIER   0

◆ DEFAULT_RESTAMP_PACKETS

#define DEFAULT_RESTAMP_PACKETS   10

◆ DEFAULT_SILENCE_DISTANCE

#define DEFAULT_SILENCE_DISTANCE   100

◆ htonll

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

◆ ntohll

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

◆ SKEW_DETECTION_WAIT_TIME_SECS

#define SKEW_DETECTION_WAIT_TIME_SECS   10

Typedef Documentation

◆ janus_pp_rtp_skew_context

Function Documentation

◆ main()

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

Variable Documentation

◆ janus_faststart

gboolean janus_faststart = FALSE

◆ janus_log_colors

gboolean janus_log_colors = TRUE

◆ janus_log_global_prefix

char* janus_log_global_prefix = NULL

◆ janus_log_level

int janus_log_level = 4

◆ janus_log_timestamps

gboolean janus_log_timestamps = FALSE

◆ lock_debug

int lock_debug = 0