View Full Version : OpenGL MPEG2
08-24-2007, 07:26 PM
Im searching for a solution for OpenGL that can play MPEG2 (with sound) on Windows, Linux and Mac... I google quite a bit and didn't find anything relevant... does anybody have a suggestion?
08-24-2007, 08:05 PM
You should decode to YUV only, and do the YUV->RGB calculations with a shader. It's recommend to use a Pixel Buffer Object for asynchronous texture streaming. There are some other lib too
08-25-2007, 01:59 AM
Yeah me too I pinpoint libmpeg2 on top of my list, however what Im looking for is more like an example of how to implement it with GL... any links?
08-25-2007, 02:16 AM
Some open source code doing video to OpenGL :
Quake 2/3, VLC (not used by default, but works well too).
The simple case : decode mpeg stream to a RGB buffer (libmpeg2), then glTexSubImage it to a texture, then draw quad with said texture at video rate (ie 30fps). The sound is of course a different matter.
Then to optimize performance, follow oc2k1 hints.
08-25-2007, 02:56 AM
ZbuffeR, I get that part right...
the thing is, well, even before this post I was already digg'in inside libmpeg2 and it's not really friendly friendly inside that library... haven't figure it out yet how to get the RGB buffer...
Any help is appreciated here...
08-25-2007, 03:28 AM
Ah ok, so your problem is not opengl related :)
I re-suggest you have a peek at VLC source code.
08-25-2007, 06:11 PM
well yes and no... I mean I just want to find an example/tutorial that show of to use libmpeg2 with OpenGL ;)
I still don't know how to pass the RGB buffer to GL and got some strange results so far ;)
Just hope that someone can help!
08-26-2007, 05:48 AM
libmpeg2 is a low level library. You have to write your own demuxer. But there are some examples, that can be modified, to use them with Opengl.
Libmpeg3 is simpler, but the last time I had problems to sync audio to video.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.