Livestreaming has become an integral part of our digital landscape, allowing us to connect with audiences worldwide in real time. Whether you're a content creator, a broadcaster, or a business looking to engage customers, ensuring high broadcast quality is crucial. In this article, we will explore the key strategies and techniques for maximizing broadcast quality in LiveSwitch, ensuring an exceptional livestreaming experience for your audience.
Question: How do I maximize broadcast quality when I have a single C# sending client?
Answer: When it comes to maximizing broadcast quality with a single C# sending client, it's important to explore the various encoder settings available. In this guide, we will primarily focus on Vp8/Opus, as these codecs are commonly used. Keep in mind that there are additional options beyond those listed below that may impact quality. However, I will highlight the key settings that I prioritize when adjusting the quality of my broadcasts.
Please note that the majority of our use cases are conferencing so our default settings are optimized for conferencing purposes, which may not yield the best results for broadcasting. By modifying the settings from our VOIP defaults to align more with broadcasting requirements, you can significantly enhance the quality of your streams.
To ensure high-quality audio in your broadcasts, you can fine-tune the Opus encoder settings. Consider the following configuration:
var audioEncoder = new FM.LiveSwitch.Opus.Encoder();
audioEncoder.TargetBitrate = 512; //max quality... defs be overkill. 1-512
audioEncoder.CodecConfig.ForceChannels = 2; // 1-2
audioEncoder.CodecConfig.IsVbr = true; // true/false
audioEncoder.CodecConfig.UseConstrainedVBR = false; //true/false
audioEncoder.CodecConfig.Application = FM.LiveSwitch.Opus.ApplicationType.Audio; // instead of voip - reduces compression.
audioEncoder.CodecConfig.Bandwidth = FM.LiveSwitch.Opus.Bandwidth.FullBand; // reduces compression.
For optimal video quality in your broadcasts, it is essential to configure the VP8 encoder settings. Consider the following adjustments:
var videoEncoder = new FM.LiveSwitch.Vp8.Encoder();
videoEncoder.TargetBitrate = 3000; // for 720 at 30 fps
videoEncoder.CodecConfig.MinQuantizer = 23; // 0 - 63 - lowers better quality
videoEncoder.CodecConfig.MaxQuantizer = 56; // 0 - 63 - lowers better quality
videoEncoder.CodecConfig.EndUsageMode = FM.LiveSwitch.Vpx.EndUsageMode.CQ; // constant quality (will raise bitrate during motion)
Additional Resources:
Different encoding modes impact the behavior of bitrate during motion events. Here are some observations based on tests with a target bitrate of 1024:
CBR showcases a significant drop in bitrate during full-frame motion, leading to pixelation. It is the default mode but may not be ideal for maintaining high-quality video.
The bitrate spikes upward during motion and gradually decreases, offering good quality. However, it may trigger bandwidth adaptation if viewers' connections cannot handle the higher bitrate.
CQ mode disregards the target bitrate and uses any required bitrate to maintain quality. This flexibility makes it a favorite choice of mine, although it is more susceptible to bandwidth adaptation.
Need assistance in architecting the perfect WebRTC application? Let our team help out! Get in touch with us today!