menu_bookDocumentation
Media Support - Video and Audio Codecs
Media Support - Video and Audio Codecs
Video and audio codec/format support for playback, streaming, and encoding.
Video Codecs
| Codec | Formats | Encode | Notes |
|---|---|---|---|
| VP9 | .webm, .mp4 | Yes | Primary recommended format |
| AV1 | .webm, .mp4 | Yes | Best compression and quality |
| WebP | .webp | Yes | Supports transparency |
| H.264 | .mp4 | No | Windows only via Media Foundation |
Audio Codecs
| Codec | Formats | Notes |
|---|---|---|
| Opus | .ogg, .opus, .webm | Recommended for music/voice |
| Vorbis | .ogg, .webm | Good compression |
| FLAC | .flac | Lossless quality |
| MP3 | .mp3 | Universal compatibility |
| WAV / PCM | .wav | Uncompressed, large files |
| AAC | .mp4 | Windows only |
Video Textures
Play video on surfaces in-game:
CSHARP
// Load video as texture
var videoTexture = VideoTexture.FromFile("videos/intro.webm");
// Apply to material
var material = Material.Load("materials/screen.vmat");
material.SetTexture("color", videoTexture);
// Control playback
videoTexture.Play();
videoTexture.Pause();
videoTexture.Seek(10.0f);
// Events
videoTexture.OnFinished += () => Log.Info("Video ended");Audio Streaming
For music and programmatic audio:
CSHARP
// Play streaming audio
var handle = Sound.PlayFile("music/background.ogg");
handle.Volume = 0.5f;
// 3D positioned streaming
var handle = Sound.PlayFile("ambient/wind.ogg", WorldPosition);Voice Chat
Built-in voice chat support:
- Positional 3D audio
- Audio effects pipeline
- Lip sync support
- Occlusion/dsp effects
Video Encoding
Export gameplay or Movie Maker content to video:
CSHARP
// Start recording video
VideoRecorder.Start("output.webm", new VideoRecorderSettings
{
Resolution = new Vector2(1920, 1080),
FrameRate = 60,
Codec = VideoCodec.VP9,
Quality = VideoQuality.High
});
// Stop recording
VideoRecorder.Stop();Platform Notes
- Windows: All formats supported, including H.264/AAC via Media Foundation
- Linux: VP9, AV1, WebP, Opus, Vorbis, FLAC, MP3, WAV supported
- H.264/AAC: Windows only, not recommended for cross-platform content
Lip Sync
Automatic lip sync generation from audio:
- Phoneme extraction
- Blend shape/morph target control
- Real-time processing
Was this helpful?