Video codecs
The Vonage platform leverages the WebRTC protocol and the real-time video codecs that are supported by WebRTC. In particular, the Vonage platform supports the VP8, VP9, and H.264 video codecs.
Streams use the VP8 codec, which is supported on all clients, unless you set a preferred codec for the project that the session belongs to (see Setting the preferred video codec for a project.)
Across the broad ecosystem of devices and browsers that are supported there are varying levels of support for the VP8 and H.264 real-time video codecs.
Some endpoints support both video codecs, and some support one video codec. Depending on the type of application you are building and the types of browsers and devices your end users will use, your choice of preferred codec will change.
What is a video codec?
A video codec has two parts, an encoder and a decoder. It has the ability to encode (compress) incoming digital video frames from a webcam into a stream of binary data that can be sent over a network.
It also has the ability to ingest a stream of binary data and decode (decompress) it into a flow of raw video frames that can be displayed on a screen.
The mechanism for encoding and decoding the video is the codec standard and for the purpose of this page we are going to talk about two popular ones, VP8 and H.264.
VP8 vs H.264
The VP8 real-time video codec is a software codec. It can work well at lower bitrates and is a mature video codec in the context of WebRTC.
As a software codec it can be instantiated as many times as is needed by the application within the limits of memory and CPU. The VP8 codec supports the Scalable Video feature, which means it works well in large sessions with supported browsers and devices.
The H.264 real-time video codec is available in both hardware and software forms depending on the device.
It is a relatively new codec in the context of WebRTC although it has a long history for streaming movies and video clips over the internet.
Hardware codec support means that the core CPU of the device doesn’t have to work as hard to process the video, resulting in reduced CPU load.
The number of hardware instances is device-dependent with iOS having the best support.
Given that H.264 is a new codec for WebRTC and each device may have a different implementation, the quality can vary.
As such, H.264 may not perform as well at lower bit-rates when compared to VP8. H.264 is not well suited to large sessions since it does not support the Scalable Video feature.
Setting the preferred video codec for a project
You can set the preferred video codec for a project on the Project page of your Video account. Valid choices are VP8, H264, or VP9, but applicability may vary depending on the type of session.
In routed sessions (sessions that use the Media Router), the Media Router selects the preferred codec during the publisher's negotiation. It will choose between VP8 and H.264 (if available), prioritizing the user-selected codec when supported by the device. VP9 is not currently available for routed sessions, and it will currently fall back to VP8.
In relayed sessions, where clients send streams directly to one another, the OpenTok Media Router is not involved in the negotiation. Each publishing-subscribing pair tries to find a common video codec, preferring the user-selected codec when supported by both devices. As a result, the video codec used by the pair may differ from the preferred codec set for the project.
If you do not set a preferred codec for a project, the VP8 codec, which is supported on all clients, is used.
Codec coverage
The following tables list the real-time video codec capabilities of the supported endpoints.
Note that almost all devices have H.264 decoder support for streamed movies, however the tables below are focused on the real-time video codec (encode and decode) capabilities of the devices.
| Desktop browsers | VP8 | H.264 |
|---|---|---|
| Chrome | Yes | Yes |
| Firefox | Yes | Yes |
| Safari | Yes 1 | Yes |
| Internet Explorer (Plugin) | Yes 2 | Yes 2 |
| Edge | Yes | Yes |
1 VP8 is available in Safari 12.1+, which ships on macOS 10.14.4 and is also available for macOS 10.13.6 and 10.12.6.
2 Support for Internet Explorer has been removed removed in OpenTok.js 2.17.
| Mobile browsers | VP8 | H.264 |
|---|---|---|
| Chrome on Android | Yes | Partial 1 |
| Firefox on Android | Yes | Yes |
| Mobile Safari | Yes 2 | Yes |
| Chrome/Firefox on iOS 3 | - | - |
1 Chrome on Android only supports H.264 on devices that contain the Qualcomm and Exynos chipsets and require Chrome 65 or higher.
2 VP8 is available in Safari on iOS 12.2+.
3 Non-Safari browsers running in iOS (for example, Chrome and Firefox) use a Safari webview under the hood. The Safari webview does not support WebRTC and the OpenTok.js SDK.
- Hardware H.264 is supported on devices that contain the Qualcomm and Exynos chipsets, in addition to a subset of HiSilicon and MediaTek chipsets. Fallback to software H.264 is supported on Android M or higher.
Codec feature support across endpoints

Percentage of Android devices that support the codec
** Support for Internet Explorer no longer exist in OpenTok.js 2.17.
Detecting codec support in clients
Not all Android devices support the H.264 codec, and older versions of Safari do not support VP8. OpenTok.js and the Android SDK include methods for checking the supported codecs available to the client.
Detecting supported codecs in the browser
The OT.getSupportedCodecs() method returns a Promise that is resolved (on success) with an object that has two properties: videoDecoders, an array of supported video codecs for decoding, and videoEncoders, an array of supported video codecs for encoding.
The following example gets the list of supported codecs for encoding and decoding video streams:
Detecting supported codecs using the Android SDK
The MediaUtils.SupportedCodecs.getSupportedCodecs(context) returns a MediaUtils.SupportedCodecs object that that has two properties: videoDecoders, an ArrayList of supported video codecs (defined by the MediaUtils.VideoCodecType class) for decoding, and videoEncoders, an ArrayList of supported video codecs (defined by the MediaUtils.VideoCodecType class) for encoding.
The following example gets the list of supported codecs for encoding and decoding video streams:
Issues to consider when selecting your preferred real-time video codec
Interoperability
The main interoperability conflict is around Android devices, older versions of Safari, and Linux. VP8 works on all Android devices, both on Android Chrome and the Android SDK, but H.264 codec support on Android is not ubiquitous. Older versions of Safari do not have VP8 codec support. The Linux SDK does not support H.264.
Session size
Both H.264 and VP8 can work well for endpoints in small sessions (for example, 1-3 participants). However, since there is no Scalable Video support with H.264, we do not recommend H.264 for large sessions.
Video quality
Since the same VP8 video codec implementation is used on almost all endpoints the quality is roughly the same. VP8 works well at lower bitrates.
In addition, Scalable Video is available with VP8. Scalable Video significantly improves the video quality in larger sessions.
The quality of H.264 will vary across devices since the implementation of H.264 varies.
In addition we have encountered differences in quality depending on the operating system version running on the device. The quality of H.264 at lower bitrates is generally not as good as VP8.
H.264 works well on iOS devices since they have good support for H.264 hardware acceleration. This reduces the CPU load and improves battery life.
VP9 offers improved video quality over VP8 when operating at the same bitrate. The quality improvements may require increased CPU load than VP8, though.
Example scenarios
Here are the recommended video codec to use in some example scenarios:
- In sessions with 2-3 participants where interoperability with older versions of Safari is critical, use the H.264 video codec.
- In sessions with 2-3 participants where only iOS devices are involved, use the H.264 video codec to take advantage of the hardware acceleration.
- Webinars and Large Classroom sessions should use the VP8 codec to take advantage of the Scalable Video feature.
- In Sessions where support for all Android devices is critical, use the VP8 codec.