Most WebRTC implementations require some kind of recording these days, but they are often cumbersome and implementing them is complex. Some even involve docker containers with X-servers running inside capturing a chrome window. Given their implementation complexity, it’s even harder to debug them, so is there an alternative to this tedious process?

Enter Kurento Media Server.

Kurento is an open-source media server, it has video transcoding and recording capabilities built-in it has been in development for quite some time now, so how can we achieve recording with Kurento?

Kurento Media Server has ‘RecorderEndpoints’ to which we can redirect the media that comes out of the peer’s browser and save it in many different formats on the server, because all streams go through Kurento individually, we have the flexibility of recording each stream separately.  In turn, this flexibility allows us to arrange the resulting videos as we wish and helps us not to loose any detail of the interaction, which is very important when talking about archiving purposes. This setup has a very simple flow.

 

Basic diagram for media flow.
Fig. 1: Basic architecture regarding connection between two peers and Kurento’s different EndPoints

How We Implemented Kurento Recording

We wanted to simplify the process as much as possible. We used a docker image which contains kurento and takes in parameters to configure STUN/TURN servers. This adds modularity to our setup, with a simple environment variable change, you can change from one STUN/TURN server to another.

To demonstrate how it works, we created a demo which takes a one-to-one video-chat and records the client’s streams individually, then outputs them into the server.

session with two peers
Fig. 2: Two peers share one session while Kurento is recording both parts of the session.
Playback of fboth sessions
Fig. 3: Playback of both streams for the session.

All in all, Kurento solves many of the common problems found when trying to implement archiving to a video-chat or video-conference solution by providing a simple interface for our developers to work with and a straightforward setup and configuration process.

See for Yourself

In order to see the source of this project and run an instance in your machine, you can check this github repository and follow this instructions.

Step #1 – Clone and get the environment ready.

Step #2 – Enter your credentials where  needed.

Modify ./static/js/common.js so it contains your STUN/TURN credentials instead of mock data.

Step #3 – Setup your Kurento instance (optional if you already have one)

install Docker if you don’t have installed, then run the following command.

Step #4 – Run the demo

On the project root directory run the following commands:

After this you can go to http://localhost:3000/one-to-one/{your-session-here} to join a session with a peer, your resulting videos should be in your /tmp folder if you used our docker-compose.yml, else they will be on /tmp wherever Kurento Media Server is running.

To learn more about TURN/STUN setup, check out our Quick Guide for STUN/TURN.

Want to discuss more about implementing archiving solutions for your communications platform? We have a great, experienced team, and we’ll be happy to help you out on your endeavors, Contact us today!

Recent Blog Posts