SIPSorcery.VP8
April 29, 2026 ยท View on GitHub
A pure C# VP8 video codec for the SIPSorcery real-time communications library. No native binaries, no PInvoke -- runs anywhere .NET runs.
This is a port of Google's reference VP8 implementation (libvpx) into managed C#. Use this package when you want VP8 video support without the FFmpeg native dependency required by SIPSorceryMedia.FFmpeg.
Status
| Path | State |
|---|---|
| Decoder | Working. Functional but slow -- the C-to-C# port hasn't been performance-tuned. Acceptable for low-resolution / low-frame-rate WebRTC peers. |
| Encoder -- keyframe (I-frame) | Working. DC_PRED for Y / UV, single token partition, default quantizer Q=32. |
| Encoder -- inter (P-frame) | Working. ZEROMV referencing LAST_FRAME for every macroblock. No real motion estimation yet (NEWMV is on the roadmap). |
| WebRTC interop | Verified end-to-end against Chrome via the example apps below. |
For the technical write-up, the foundation-PR sequence, and the
ongoing roadmap (real motion estimation, additional intra modes,
GOLDEN / ALTREF references, loop filter), see
diary/2026-04-26-Claude-Opus-4.7/result.md.
Installation
dotnet add package SIPSorcery
dotnet add package SIPSorcery.VP8
Quickstart -- send a VP8 test pattern over WebRTC
using SIPSorcery.Media;
using SIPSorcery.Net;
using Vpx.Net;
var pc = new RTCPeerConnection(null);
// VP8Codec implements both IVideoEncoder (encode) and IVideoSink (decode).
var vp8Codec = new VP8Codec();
// Wrap it as an encoder end-point.
var encoderEndPoint = new Vp8NetVideoEncoderEndPoint(vp8Codec);
// Drive it from a test pattern source -- pass the codec directly, no
// I420->BGR->I420 round-trip in the wiring.
var testPatternSource = new VideoTestPatternSource(vp8Codec);
var track = new MediaStreamTrack(testPatternSource.GetVideoSourceFormats(),
MediaStreamStatusEnum.SendOnly);
pc.addTrack(track);
testPatternSource.OnVideoSourceEncodedSample += pc.SendVideo;
pc.OnVideoFormatsNegotiated += formats =>
testPatternSource.SetVideoSourceFormat(formats.First());
await testPatternSource.StartVideo();
Configuration
VP8Codec exposes a few tuning knobs:
| Property | Default | Purpose |
|---|---|---|
BaseQIndex | 32 | VP8 base quantizer index, range 0-127. Lower = better quality, higher bitrate. |
KeyframeIntervalFrames | 30 | One keyframe per N frames (1 keyframe/sec at 30 fps default). Set to 1 to force every frame to be a keyframe. |
Examples
The repository includes two end-to-end demos that use this package:
- WebRTCGetStarted -- the main repo getting-started demo. Pure C# WebRTC server streaming an animated test pattern + audio to a browser, using SIPSorcery.VP8 as the video encoder. (Originally WebRTCGetStartedVP8Net; promoted to be the canonical getting-started example now that the pure C# VP8 path is the default for in-tree WebRTC video.)
- WebRTCClientVP8Net -- pure C# WebRTC client receiving a VP8 stream from a browser and decoding it locally.
Performance characteristics
- Encoder: optimised for allocation hygiene -- effectively zero allocations per frame after warmup. Single-threaded; one core comfortably handles 30 fps at typical webcam resolutions on a modern CPU.
- Decoder: not yet performance-tuned. For 1080p / 30 fps you'll want the FFmpeg-based decoder.
Related packages
- SIPSorcery -- the main real-time communications library.
- SIPSorceryMedia.Abstractions
-- the
IVideoEncoderinterface this package implements. - SIPSorceryMedia.FFmpeg -- alternative VP8 implementation via native FFmpeg (faster, but pulls in native dependencies and an LGPL licence).
License
BSD 3-Clause License. See LICENSE at the repo root.