I have mediasoup v3 deployed on a $10 DigialOcean VPS. I’m using it to steaming 1080p desktop video and audio at a max bitrate of 6000kbps (for watching video games). The SFU is working great but I’m encountering a few issues. I’m not using 100% of anything. I’ve only reached 20% CPU and 30% RAM usage.
1.) Anyone watching the stream will have the video freezes and unfreezes for a second every once in a while. Could it be my mediasoup config or the networking?
2.) If the producers video lowers the bitrate (because of less changes to the video), the bitrate will either slowly increase when more thing happen on screen (resulting in temporary lag / low quality) or the video bitrate wont increase and I have to restart the producers video to fix it.
Based on these issues do you think are from my hosting network or my configuration with mediasoup?
Assuming you are using latest Chrome stable, there is a bug in libwebrtc that’s being fixed (but not yet) and makes Chrome to not send RTP retransmission packets when the receiver (mediasoup in this case) requests them via RTCP NACK:
A workaround has been added to mediasoup “devel” branch, but it’s not yet merged in “v3” branch (so no NPM release yet). A different workaround would be:
Avoid the RTP MID header (see the issue above). but for that you must make your senders use the mediasoup-client “Chrome67” handler (instead of the auto-detected “Chrome70” or “Chrome74”:
BTW if you are sending a 6000kbps without simulcast, it means that all receivers will receive 6000kbps (no matter then cannot due to limited downlink). I recommend you using simulcast so mediasoup will adapt the best layer (up to the “preferred layers” set via API in each Consumer) for each receiver.
In addition to that, the “devel” branch uses transport-cc bandwidth estimation for receiving and sending, which is MUCH better than current mechanism in mediasoup v3 (based on old REMB).
“devel” branch is not yet merged into v3, but if you add simulcast I encourage you to give it a try.
Awesome, thanks so much! I’ll check out the devel branch and add simulcast. When it comes to simulcast though, does that mean that the producer will send multiple streams to the server, which will use more bandwidth? That’s what I thought it meant.
Yes. The thing is that, if you just send a 6000kbps RTP stream and a receiver cannot handle 6000kbps, the Internet connection of that receiver will just break. With simulcast, mediasoup will be able to send a lower bitrate stream to that poor receiver.
I have run into the same issue, and i have tried the devel branch, the probability of video freeze is lower, and the time interval is longer than v3, but it still freezes random.
I don’t know your scenario, so hard to help. However, there are Producer and Consumer stats that provide pliCount and nackCount values. We can not do magic.
Maybe something with your setup? Because switching to the devel branch fixed it completely for me. I’m not too savy on the in’s and out’s of this problem though.
So it appears that switching to the devel branch has fixed the freezing issues I talked about, but I still get quality drops. Sometimes if nothing happens on screen for a while, when something does happen, it either takes forever (more than 10 seconds) to increase the bitrate, or it never increases and I have to re-create the producers and consumers all over again.
Unless you are using transport.setMaxIncomingBitrate() in server side or special encoding (with maxBitrate field) in client side Producer, I’m afraid mediasoup cannot tell the browser how much bitrate It must send.