A new era for OpenVidu: better perfomance and media quality with mediasoup

OpenVidu
7 min readJul 26, 2021

Hi, OpenVidu developers! Here we are to happily announce that our beloved platform is taking the biggest leap to date since its inception: we are adding support for a different media server. Let’s answer the most important questions you may have after coming across this news.

OpenVidu platform is made of many different parts seamlessly working together as a single coherent entity to provide videoconferencing capabilites to your application. But simplifying to the extreme, if we were to choose the two main modules of the platform, those would be what we call the OpenVidu Server and the Media Server.

  • The OpenVidu Server is the brain of OpenVidu. It handles the signaling plane of the platform, providing the necessary logic to coordinate all of the clients and the different submodules of the system.
  • The Media Server is the heart of OpenVidu. It handles the media plane of the platform, sending and receiving audio and video streams from the clients.

Kurento has always been the only Media Server compatible with OpenVidu. But starting from 2.19.0 release, OpenVidu clients now have the possibility of trying the beta support of a new Media Server: mediasoup.

Why mediasoup?

Since OpenVidu’s inception, Kurento has been the media server at the core of the platform. OpenVidu team is the same team that created Kurento almost a decade ago, and still mantains it. And it has been a great ride! Kurento was created as a generic and versatile server, intended to provide full access to media streams for low-level processing. It is very powerful and allows the devolopment of quite advanced use cases. For example, it is one of the few available Media Servers that natively supports audio and video filters in real time, with no additional components needed. And it also makes a straightforward process the integration of IP cameras, with its RTSP and transcoding capabilites.

This is great stuff, but as everything worthwhile it comes with a trade-off: the necessary architecture can be quite complex and rather expensive in terms of hardware resources. Every single video track processed by Kurento involves multiple threads of execution and a good amount of memory. If these advanced media processing capabilites are not needed, then there are other media servers with simpler architectures and more resource efficient. Like mediasoup.

mediasoup is a lightweight and modern media server, perfect for videoconferencing. It brings lots of good stuff when comparing it with Kurento in the context of OpenVidu:

Media quality improvements

Real-time media over the Internet has been evolving and improving over the last few years with the addition of new codecs and new strategies built on top of WebRTC. mediasoup has always been kept up to date with these improvements. OpenVidu may greatly benefit from them, among which the following stand out:

  • Simulcast: publishers may send different encodings of the same video stream, each one with a different quality, so that each subscriber can receive the one that best suits their network speed. This can substantially improve the experience for all participants in the videoconference: each participant receives the video that best suits their network conditions without affecting the experience of other users.
  • VP9: this is a more advanced video codec than the widely extended VP8 and H264. It provides better compression rate and better quality with lower bandwidth usage, at the expense of a higher CPU usage on the client side. It also supports SVC. Google Chrome has had it for a while now, and other browsers are getting onboard.

6x more media streams

We have seen in our first comparative studies that the performance has been increased 6 times. This means that mediasoup is capable of handling up to 6 times more media streams than Kurento, using the same hardware.

Maximum number of 1-to-1 video sessions, with their corresponding number of participants and video streams, using Kurento and mediasoup in the same 4 CPUs — 8GB server
Maximum number of 4-to-4 video sessions, with their corresponding number of participants and video streams, using Kurento and mediasoup in the same 4 CPUs — 8GB server

5x quicker connections

Media connections are established 80% quicker in mediasoup than Kurento. This means that with Kurento the average time between a customer calling the subscription operation and the video being actually played on their device, it could average around 1.25 seconds. With mediasoup it averages 0.25 seconds.

Connection establishment time in OpenVidu, Kurento VS mediasoup

100% compatible with your current OpenVidu applications

Changing such a central component as the media server usually involves a lot of refactoring work at the application level. New SDKs must be used, basic architectural concepts may radically change, etc… But OpenVidu hides all of this complexity. There’s no need to change a single line of your app. What used to work with Kurento will now work with mediaosup.

We are mediasoup collaborators

We believe in open source software. mediasoup is a great open source product with a great active community. And OpenVidu is part of that community. We have collaborated in the past with mediasoup creators in several projects, and plan to continue to do so on a recurring basis in the future. A couple examples of mediasoup projects in which OpenVidu team has been involved are the following:

Also important in making the decision to support mediasoup has been the fact that both OpenVidu and mediaosup are developed in the same region of the world. Having both teams working in the same area is a great opportunity for more in-person collaboration and synergies. We at OpenVidu are very excited to use and contribute to such a great tool developed so close to us!

Select the best media server for your use case

After presenting the strengths of mediasoup, you may be wondering if this means that Kurento is no longer valid for any use case. Well, it doesn’t have to: if you need advanced processing of media streams such as real time audio or video filters or the usage of IP cameras, then you will need Kurento’s powerhouse. But for videoconferencing software, mediasoup will provide overall better quality and perfomance.

Try the beta support of mediasoup in OpenVidu

To make sure everything works as expected, we need your help. Even though we have been through one of the most intense testing periods OpenVidu has ever known, we still have to ensure that mediasoup works fine in real environments. Therefore, mediasoup support will be in beta for a while.

In the future mediasoup support in OpenVidu will become a commercial feature (more on that later), but it will be free as it remains in beta. An OpenVidu deployment using mediasoup will have no cost at all. The only requisite is having an OpenVidu Pro license. You can get one for free here: https://openvidu.io/account

Please note that when the beta period officially ends, you will no longer be able to use your OpenVidu Pro cluster with mediasoup beta support. We will notify through all our official channels before suspending the beta.

It is extremely simple to use mediasoup. No change is required at all in your application. Starting from release 2.19.0, you must simply add this configuration property to your .env configuration file, and then restart your OpenVidu Pro cluster: OPENVIDU_PRO_MEDIA_SERVER=mediasoup

Beta limitations

As a beta feature, mediasoup support in OpenVidu comes with a handful of limitations that will be solved in the near future, when it finally reaches the General Availability stage. These are:

  • There is no INDIVIDUAL recording.
  • There is no support for the forced media codec feature.
  • Be aware. As a beta, there may be bugs that affect the expected general behavior.

New OpenVidu Enterprise edition

A new whole set of advanced features are coming to OpenVidu. mediasoup is just the beginning. New exciting scalability, fault tolerance and security features are in development right now, and our intention is to offer them as part of a new OpenVidu edition: OpenVidu Enterprise, that will be joining OpenVidu CE and OpenVidu Pro.

Existing OpenVidu CE users may find interesting upgrading to OpenVidu Enterprise. Due to the huge difference in computing resources usage between the two media servers, maintaining a Kurento Media Server cloud instance tends to be more expensive than doing the same with mediasoup, for a similar amount of sessions and participants. This means that given enough load, the cost of maintaining an OpenVidu CE deployment on a cloud provider could be higher than doing the same for an OpenVidu Enterprise deployment, even after adding the cost of the license! We have designed this new pricing tier to help you obtain better value for your money.

https://docs.openvidu.io/en/latest/openvidu-enterprise/

What’s next regarding mediasoup

We honestly believe that OpenVidu will improve dramatically with mediasoup support. Lots of use cases may benefit from its unique features and improve the user experience tremendously without even having to modify the source code. We are working hard to overcome the above-mentioned limitations and release a final version of mediasoup support. We cannot wait to hear your first impressions of this exciting new chapter for OpenVidu!

This may have crossed your mind, but we will always give Kurento some love whenever it needs it

Stay tuned for next iterations! You can follow us on Twitter and a Star in GitHub is always welcome :)

--

--