Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 5 down vote accepted

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

Your Answer


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.