Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Quaspen/MonoVideoArchive

Repository files navigation

⚠️ Do not use

This repository is an outdated backup of a previous project. It is no longer maintained or updated.
It is hosted here solely for preservation purposes.

MonoVideo

An experimental library aiming to make video playback in MonoGame possible. Only for DesktopGL on Windows

Basic Usage

  1. Download or compile FFmpeg, which is a required component to stream your video into raw format. Place the ffmpeg executable somewhere near your game. (ffprobe and ffplay are not needed!).
    Development tests and examples use pre-compiled ffmpeg_essentials_build by GyanD: Latest version

  2. Set the path to your ffmpeg executable:

You must do this before creating any Video instance!

Video.SetFFmpegExecutablePath(Path.Combine("lib", "ffmpeg.exe"));
  1. Create a Video instance and provide the path to your video and an instance of the graphics device:
var myVideo = new Video(Path.Combine("Content", "video.mp4"), _graphics.GraphicsDevice);
  1. Start the video playback. This will also load the metadata if you haven't done so already (see Optimization):
myVideo.Play();
  1. Update the video and draw the current frame:
protected override void Update(GameTime gameTime)
{
    myVideo.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
    _spriteBatch.Begin();
    if (videoPlayer.CurrentFrame is not null) // Check whether the video is playing, or you'll get a null texture!
        _spriteBatch.Draw(myVideo.CurrentFrame, Vector2.Zero, Color.White);
    _spriteBatch.End();
}

And that's it! Your video is now streaming from the disk!

👉 Also check out the minimal example!

Where's the sound?

¯\_(ツ)_/¯

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages