Jump to content
  • Advertisement
Sign in to follow this  
MattProductions

Play a video file in c++

This topic is 2417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys


I'm coding a small game atm (using a game engine) and I want to implement a video.
Since there isn't a video class included in the engine, I'm looking for some c++ code to do it for me.

I've been looking all over the internet for a few hours now, without any succes.
Most of them have dead links or talk about a win32 form (and not an application, which I use).

So hopefully anybody of you guys can help me solve this problem (I need it pretty quick).


Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Many thanks for your reply, but unfortunately that's not really what I'm looking for.

I'm looking more for a code that I can paste (and maybe adjust a bit) in my engine to make it work.
Is their something like that available or is it just a weird idea?

Share this post


Link to post
Share on other sites
Virtually nothing is truly copy-and-paste in the programming world, unless you're doing it wrong.

You'll have to live with at least a modicum of adjustment and customization for almost any system, especially one as large and complex as video rendering. Sometimes you must bend your code to fit the tool, and sometimes (for the better tools) you can bend the tool to fit your code.

Share this post


Link to post
Share on other sites

I'm looking more for a code that I can paste (and maybe adjust a bit) in my engine to make it work.
Is their something like that available or is it just a weird idea?


Sure. '<embed src="www.youtube.com/..../>

But if working in C++, then no...

Reason for that is somewhat convoluted and not entirely technical.
a) you use proprietary codec, which comes with proprietary encoding and playback tools. How well they mesh with your way of doing graphics is down to luck
b) you use one of standard codecs, in which case third-party implementations aren't licensed for distribution (patents, IP, copyrights, etc.), so they're either reference implementations or long abandoned projects before this became a major issue
c) you use whatever OS provides. Unfortunately, most OSes come with quirks, so unless you want to encode same content for different formats, you need to redistribute the media frameworks (such as DX or DirectShow or similar). Most of these again come with various restrictions so they are not convenient to use by design.

Media is just a legal mess, it's also a reason why Java gave up on JMF and why browser vendors are having all those debates about what the content should look like.

Share this post


Link to post
Share on other sites

What engine are you using? OpenGL or DirectX?


Neither OpenGL nor DirectX (nor, more pedantically, Direct3D) is an "engine." OGL and D3D are graphics APIs, which sit below the level of an engine.

Share this post


Link to post
Share on other sites

[quote name='DvDmanDT' timestamp='1332891708' post='4925837']
What engine are you using? OpenGL or DirectX?


Neither OpenGL nor DirectX (nor, more pedantically, Direct3D) is an "engine." OGL and D3D are graphics APIs, which sit below the level of an engine.
[/quote]

Ahh, yes, ofcourse. I should probably consume my caffeine before I post. What I mean was "Are you using an engine, if so, which one? Or have you rolled your own? Does the engine use OpenGL or Direct[2D|3D|Draw]"?

Share this post


Link to post
Share on other sites

Many thanks for your reply, but unfortunately that's not really what I'm looking for.

I'm looking more for a code that I can paste (and maybe adjust a bit) in my engine to make it work.
Is their something like that available or is it just a weird idea?


Bink video is one of my favorites, but you have to license it (last I checked).

Share this post


Link to post
Share on other sites

Since there isn't a video class included in the engine, I'm looking for some c++ code to do it for me.
I have successfully streamed webcam input to a D3D9 surface using DirectShow in the past. DirectShow is old and perhaps deprecated by now but I'm fairly sure it would happily decode anything you'd throw at it.
If you are really desperate, I could look for the code but it was a project thrown together with no plan of maintaining it so the code is old. And not so nice to look at.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!