Displaying a video in DirectX
Asked Answered
R

2

5

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).

Refractive answered 17/7, 2009 at 17:14 Comment(1)
DirectShow is not an option? It uses Direct3D for video rendering.Providenciaprovident
A
7

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.

Allotrope answered 17/7, 2009 at 19:2 Comment(0)
H
1

Have you looked at Bink video? Its what lots of games use for video playback. Works great and you don't have to code all that video stuff yourself from scratch.

Hussite answered 18/7, 2009 at 8:59 Comment(1)
Unfortunately, it is also very expensive. Theora is a free alternative, and is just as good from an objective standpoint.Hygienics

© 2022 - 2024 — McMap. All rights reserved.