Displaying a video in DirectX

Fire Lancer picture Fire Lancer · Jul 17, 2009 · Viewed 8.7k times · Source

What is the best/easiest way to display a video (with sound!) in an application using XAudio2 and Direct3D9/10?

At the very least it needs to be able to stream potentially larger videos, and take care of the fact that the windows aspect ratio may differ from the videos (eg by adding letter boxes), although ideally Id like the ability to embed the video into a 3D scene.

I could of course work out a way to load each frame into a texture, discarding/reusing the textures once rendered, and playing the audio separately through XAudio2, however as well as writing a loader for at least one format, ive also got to deal with stuff like synchronising the video and audio components, so hopefully there is an eaier solution available or even a ready made free one with a suitable lisence (commercial distribution in binary form, dynamic linking is fine in the case of say LGPL).

Answer

Virne picture Virne · Jul 17, 2009

In Windows SDK, there is a DirectShow example for rendering video to texture. It handles audio output too.

But there are limitations and I can't honestly call it easy.