Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is there a way to render a video from file (avi, mp4, etc...) to a texture in a directx11 environment?

If so, how?

share|improve this question
add comment

1 Answer 1

Yes, first you need to read the container (avi, mp4 etc) and then decodee it's contents that can be h264 for example) and then you'll get an rgb output that can be copied over into a texture like you normally would do, if the video is not HD you could do this every frame to play it back.

You can use libffmpeg to read the video, but it's a little tricky i recommend you if the video is not too big to convert it into raw RGB data that you can read easily in your app.

share|improve this answer
    
This pretty much nails it. Other library alternatives are possible of course - and other libraries exist to further supplement the process if you give more language details. If you're using .NET (with say SlimDX or SharpDX) there's some nifty bindings for all sorts of tools to make this job a cinhch. –  Vaughan Hilts Feb 12 '13 at 16:11
    
thanks, actually the video is quite large (720p) i am not sure if copying a texture that big each frame is fast enough for 60fps. anyway isnt there a way to decode on the gpu directly to a texture? –  clamp Feb 15 '13 at 8:53
    
The problem about decoding high resolution videos is the latency almost all codecs have high latency decoding, even decoding in the gpu what you need is a fast decoder like developer.nvidia.com/nvidia-codec-libraries for example , just to put it in perspective Bink Video is the standard in AAA games this days cuz it's ultra fast to decode in realtime, but isn't free tho... –  Jeremy Rodriguez Feb 16 '13 at 10:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.