#
WebM file output
Video Capture SDK .Net Video Edit SDK .Net Media Blocks SDK .Net
WebM is an open, royalty-free media file format designed for the web. It provides high-quality video streaming with low computational overhead. WebM is optimized for HTML5 video and supports VP8/VP9 video codecs along with Vorbis and Opus audio codecs.
#
Windows-only output
VideoCaptureCore VideoEditCore
The Windows-specific implementation uses the WebMOutput class from the VisioForge.Core.Types.Output
namespace.
#
Basic Usage
using VisioForge.Core.Types.Output;
// Create WebM output settings
var webmOutput = new WebMOutput();
// Configure basic settings
webmOutput.Video_Mode = VP8QualityMode.Realtime;
webmOutput.Video_EndUsage = VP8EndUsageMode.VBR;
webmOutput.Video_Encoder = WebMVideoEncoder.VP8;
webmOutput.Video_Bitrate = 2000;
webmOutput.Audio_Quality = 80;
// Apply settings to your core object
var core = new VideoCaptureCore(); // or VideoEditCore
core.Output_Format = webmOutput;
core.Output_Filename = "output.webm";
#
Advanced Configuration Options
#
Video Settings
var webmOutput = new WebMOutput();
// Thread Management
webmOutput.Video_ThreadCount = 4; // Number of encoding threads
// Quality Control
webmOutput.Video_MinQuantizer = 4; // Range: 0-63 (lower is better quality)
webmOutput.Video_MaxQuantizer = 48; // Range: 0-63
webmOutput.Video_Bitrate = 2000; // Target bitrate in kbps
// Keyframe Control
webmOutput.Video_Keyframe_MinInterval = 30; // Minimum frames between keyframes
webmOutput.Video_Keyframe_MaxInterval = 300; // Maximum frames between keyframes
webmOutput.Video_Keyframe_Mode = VP8KeyframeMode.Auto;
// Performance Optimization
webmOutput.Video_CPUUsed = 0; // Range: -16 to 16
webmOutput.Video_LagInFrames = 25; // Frame look-ahead buffer
webmOutput.Video_ErrorResilient = true; // Error resilience for streaming
#
Error Resilience and Buffer Control
// Buffer Management
webmOutput.Video_Decoder_Buffer_Size = 6000; // Buffer size in ms
webmOutput.Video_Decoder_Buffer_InitialSize = 4000; // Initial buffer in ms
webmOutput.Video_Decoder_Buffer_OptimalSize = 5000; // Optimal buffer in ms
// Rate Control
webmOutput.Video_UndershootPct = 50; // Undershoot percentage
webmOutput.Video_OvershootPct = 50; // Overshoot percentage
#
Cross-platform WebM output
VideoCaptureCoreX VideoEditCoreX MediaBlocksPipeline
The cross-platform implementation uses the WebMOutput class from the VisioForge.Core.Types.X.Output
namespace, which provides more flexibility in codec selection.
#
Basic Usage
using VisioForge.Core.Types.X.Output;
using VisioForge.Core.Types.X.VideoEncoders;
using VisioForge.Core.Types.X.AudioEncoders;
// Create WebM output with filename
var webmOutput = new WebMOutput("output.webm");
// Configure VP8 video encoder
webmOutput.Video = new VP8EncoderSettings();
// Configure Vorbis audio encoder
webmOutput.Audio = new VorbisEncoderSettings();
Add the WebM output to the Video Capture SDK core instance:
var core = new VideoCaptureCoreX();
core.Outputs_Add(webmOutput, true);
Set the output format for the Video Edit SDK core instance:
var core = new VideoEditCoreX();
core.Output_Format = webmOutput;
Create a Media Blocks WebM output instance:
var vorbis = new VorbisEncoderSettings();
var vp9 = new VP9EncoderSettings();
var webmSettings = new WebMSinkSettings("output.webm");
var webmOutput = new WebMOutputBlock(webmSettings, vp9, vorbis);
Check out the video and audio encoders that you can use:
#
Best Practices
Encoder Selection:
- Use VP8 for broader compatibility and faster encoding
- Use VP9 for better compression efficiency and quality
- Choose Opus over Vorbis for better audio quality at lower bitrates
Performance Optimization:
- Set thread count based on available CPU cores
- Use appropriate keyframe intervals (shorter for streaming, longer for storage)
- Balance quality vs. performance using CPU usage settings
Quality Control:
- Use VBR (Variable Bit Rate) for better quality consistency
- Set appropriate buffer sizes for streaming scenarios
- Enable error resilience for streaming applications
#
Dependencies
Make sure to include the necessary NuGet packages:
Visit our GitHub page to get more code samples.