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?

libavcodec FFmpeg

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

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?

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.

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…

Ah ok, so your problem is not opengl related :slight_smile:
I re-suggest you have a peek at VLC source code.

well yes and no… I mean I just want to find an example/tutorial that show of to use libmpeg2 with OpenGL :wink:

I still don’t know how to pass the RGB buffer to GL and got some strange results so far :wink:

Just hope that someone can help!


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.