menu_bookDocumentation

Media Support - Video and Audio Codecs

calendar_today May 3, 2026 schedule ~2 min read person patrickjr verified 50

Media Support - Video and Audio Codecs

Video and audio codec/format support for playback, streaming, and encoding.

Video Codecs

CodecFormatsEncodeNotes
VP9.webm, .mp4YesPrimary recommended format
AV1.webm, .mp4YesBest compression and quality
WebP.webpYesSupports transparency
H.264.mp4NoWindows only via Media Foundation
Recommendation: Use VP9 or AV1 for broad compatibility. AV1 offers best quality at smallest file sizes.

Audio Codecs

CodecFormatsNotes
Opus.ogg, .opus, .webmRecommended for music/voice
Vorbis.ogg, .webmGood compression
FLAC.flacLossless quality
MP3.mp3Universal compatibility
WAV / PCM.wavUncompressed, large files
AAC.mp4Windows only
Recommendation: Use Opus for compressed audio, FLAC for lossless source files.

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?