VideoSDK offers the capability to dynamically override and manage codecs throughout video and audio sessions, allowing developers to adapt media streams based on specific needs like network conditions, device performance, or application requirements. Here’s how Video SDK typically handles codec overriding:
Codec Selection
The VideoSDK provides APIs to select the desired codec for encoding and decoding video streams. It includes support for widely used codecs such as H.264, H.265 (HEVC), VP9, and the newly emerging AV1 codec. Developers can choose the most appropriate codec by considering a variety of factors, including quality expectations, bitrate limitations, and compatibility with devices.
Dynamic Codec Switching
VideoSDK enables dynamic switching of codecs during an ongoing session without interrupting the media stream. This is often handled internally by the SDK based on predefined conditions such as bandwidth changes, CPU usage, or packet loss.
The SDK monitors network conditions and automatically switches to a more suitable codec if the current one becomes inefficient. For example, it might switch from VP9 to VP8 or H.264 to reduce computational load or improve compatibility.
Custom Codec Configuration
The SDK provides detailed control over codec parameters via a configuration API. Developers can adjust settings like:
- Bitrate: Controlling the target bitrate for encoding to optimize quality vs file size tradeoffs.
- Resolution: Specifying the desired resolution for encoding or decoding.
- Frame rate: Setting the frame rate for smooth playback.
- Encoding presets: Choosing presets optimized for different use cases like low-latency streaming or high-quality offline encoding.
This level of flexibility enables developers to customize default codec settings to their specific needs and enhance performance.
Fallback Mechanisms
VideoSDK includes fallback mechanisms where, if a preferred codec fails (due to unsupported devices or insufficient resources), it automatically falls back to the next best available codec. This ensures that the session continues smoothly even under suboptimal conditions.
Codec Prioritization and Negotiation
During session setup, VideoSDK negotiates codec capabilities between participants, prioritizing preferred codecs. If a codec mismatch occurs, the SDK adapts by choosing a mutually supported codec, ensuring compatibility.
Developers can influence this process by specifying codec priorities or excluding certain codecs from the negotiation process.
Support for Low-Latency Codecs
For applications requiring low-latency communication, VideoSDK supports codecs optimized for minimal delay, such as VP8 or OPUS, and can override higher-latency codecs when real-time interaction is critical.
API Access for Codec Control
VideoSDK provides APIs that give developers direct access to codec control, allowing them to implement custom codec-switching logic. For instance, you can create event listeners that trigger codec changes based on real-time network analytics or user-defined conditions.