Janus
Janus is an open source WebRTC gateway developed by MeetEcho.
installation
You can follow the official instruction (README.md
).
I have installed Janus by the following procedure on Ubuntu 16.04:
# Install packages
$ sudo apt install libmicrohttpd-dev libjansson-dev libnice-dev \
libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev pkg-config gengetopt \
libtool automake cmake golang
# Install boringssl
$ git clone https://boringssl.googlesource.com/boringssl
$ cd boringssl
$ sed -i s/" -Werror"//g CMakeLists.txt
$ mkdir -p build
$ cd build
$ cmake -DCMAKE_CXX_FLAGS="-lrt" ..
$ make
$ cd ..
$ sudo mkdir -p /opt/boringssl
$ sudo cp -R include /opt/boringssl/
$ sudo mkdir -p /opt/boringssl/lib
$ sudo cp build/ssl/libssl.a /opt/boringssl/lib/
$ sudo cp build/crypto/libcrypto.a /opt/boringssl/lib/
# Install libsrtp
$ wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz
$ tar -zxvf v1.5.4.tar.gz
$ cd libsrtp-1.5.4/
$ ./configure --prefix=/opt
$ make shared_library && sudo make install
# Install usrsctp
$ git clone https://github.com/sctplab/usrsctp
$ cd usrsctp
$ ./bootstrap
$ ./configure --prefix=/opt && make && sudo make install
# Install libwebsockets
$ git clone git://git.libwebsockets.org/libwebsockets
$ cd libwebsockets
$ mkdir build
$ cd build
$ cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/opt -DCMAKE_C_FLAGS="-fpic" ..
$ make && sudo make install
# Install MQTT
$ git clone https://github.com/eclipse/paho.mqtt.c.git
$ cd paho.mqtt.c
$ make && sudo prefix=/opt make install
# Install rabbitmqtt
$ git clone https://github.com/alanxz/rabbitmq-c
$ cd rabbitmq-c
$ git submodule init
$ git submodule update
$ mkdir build && cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/opt ..
$ make && sudo make install
# Install janus
$ git clone https://github.com/meetecho/janus-gateway.git
$ cd janus-gateway
$ sh autogen.sh
$ export PKG_CONFIG_PATH=/opt/lib/pkgconfig
$ export LIBRARY_PATH=/opt/lib:/usr/lib
$ export C_INCLUDE_PATH=/opt/include:/usr/include
$ ./configure --prefix=/opt/janus --enable-dtls-settimeout --enable-boringssl=/opt/boringssl
$ make
$ sudo make install
$ sudo make configs
# Run janus
$ /opt/janus/bin/janus
Convert .mjr
recordings to video format
Recorder/Playout plugin demo of Janus stores the audio and video files
as .mjr
.
Those files are converted to opus
, wav
, webm
, mp4
, or srt
format using a postprocessing program, janus-pp-rec
.
janus-pp-rec
is compiled and installed when you specify the --enable-post-processing
option to configure
script before compiling janus-gateway like the following.
$ ./configure --prefix=/opt/janus \
--enable-dtls-settimeout \
--enable-boringssl=/opt/boringssl \
--enable-post-processing
Audio and video files are separately stored in /opt/janus/shared/janus/recordings/
.
To convert a set of the audio and video files to mp4
format,
you can use the following command.
$ /opt/janus/bin/janus-pp-rec \
/opt/janus/shared/janus/recordings/rec-<id>-audio.mjr audio.opus
$ /opt/janus/bin/janus-pp-rec \
/opt/janus/shared/janus/recordings/rec-<id>-video.mjr video.webm
$ ffmpeg -i audio.opus -i video.webm \
-c:v x264 -c:a aac output.mp4