在 DirectX 中显示视频
在使用 XAudio2 和 Direct3D9/10 的应用程序中显示视频(带声音!)的最佳/最简单方法是什么?
至少它需要能够传输可能更大的视频,并考虑到窗口宽高比可能与视频不同的事实(例如通过添加字母框),尽管理想情况下我希望能够将视频嵌入到3D 场景。
我当然可以找到一种方法将每个帧加载到纹理中,丢弃/重用渲染后的纹理,并通过 XAudio2 单独播放音频,但是,除了为至少一种格式编写加载器外,我还必须处理诸如同步视频和音频组件之类的东西,所以希望有一个更简单的解决方案可用,甚至是一个现成的免费解决方案,具有合适的许可(二进制形式的商业分发,在 LGPL 的情况下动态链接就可以了)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Windows SDK 中,有一个 DirectShow 示例将视频渲染为纹理。 它也处理音频输出。
但也有局限性,老实说我不能说它很容易。
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.
您看过Bink 视频吗? 许多游戏都使用它来播放视频。 效果很好,您不必从头开始自己编写所有视频内容。
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.