YUV overlay (was Re: divx)

Thanks Bill. I have installed mpeg4ip, and looked at the code. My
program does all graphics in OpenGL, therefore to play a video I have to
use texture mapping (as I do with smpeg). It seems that the important
line in the mpeg4ip code (for my purposes) is this line in
video_sdl.cpp:

rval = SDL_DisplayYUVOverlay(m_image, &m_dstrect);

which is where the frame finally gets displayed. I need to do this step
in OpenGL. I’ve been trying to find out about the YUV overlay, and I
don’t really grasp it, but it seems that the display of a YUV frame is a
video card function, which may mean that it can’t be done in OpenGL
except by resorting to a software conversion of YUV -> RGB, which
everyone says is a BAD THING. Is there a way to solve this?

thanks
Gib> You can look at mpeg4ip - it should play most divx videos.

http://www.mpeg4ip.net

Bill May

Gib Bogle wrote:

I learned how to use the smpeg library to play mpg videos within my
SDL/OpenGL application. Now I’m wondering if there is a library that
will enable me to play divx videos. Has anyone done this?

thanks
Gib

Whatever smpeg does, mpeg4ip can be modified to do, as well. (that’s
where I took most of my calls as well).

Most video codecs decode into the YUV color space, so if you’re displaying
in RGB, you’ve got that step anyway (either the decoder does it while
decoding, or the renderer does the conversion).

Isn’t an overlay just that ? Can’t you overlay the YUV on top of your
OpenGL ? (These aren’t questions that I know the answers to, just ones
I’m asking).

Bill

Gib Bogle wrote:> Thanks Bill. I have installed mpeg4ip, and looked at the code. My

program does all graphics in OpenGL, therefore to play a video I have to
use texture mapping (as I do with smpeg). It seems that the important
line in the mpeg4ip code (for my purposes) is this line in
video_sdl.cpp:

rval = SDL_DisplayYUVOverlay(m_image, &m_dstrect);

which is where the frame finally gets displayed. I need to do this step
in OpenGL. I’ve been trying to find out about the YUV overlay, and I
don’t really grasp it, but it seems that the display of a YUV frame is a
video card function, which may mean that it can’t be done in OpenGL
except by resorting to a software conversion of YUV -> RGB, which
everyone says is a BAD THING. Is there a way to solve this?

thanks
Gib

You can look at mpeg4ip - it should play most divx videos.

http://www.mpeg4ip.net

Bill May

Gib Bogle wrote:

I learned how to use the smpeg library to play mpg videos within my
SDL/OpenGL application. Now I’m wondering if there is a library that
will enable me to play divx videos. Has anyone done this?

thanks
Gib

There is a lot that I don’t know about video encoding, TUV overlays, and
OpenGL (to name a few :slight_smile: but I can tell you what I need to be able to
do. In my program the video frames must be made into textures, so I can
put them wherever I want in my OpenGL scene. Even if the YUV overlay
does work on top of OpenGL (which I doubt), it wouldn’t do me any good.

I have found a couple of YUV -> RGB conversion programs, and this is
certainly an option. But even the fastest of these (probably Intel code
using MMX) is bound to be much slower than what the GPU in my nVidia
GeForce 4 can do, and since the video decoding itself is so expensive I
need all the help I can get. I’d really like to be able to use the
video card to do the conversion, and I’ve seen tantalizing hints about
tricks using the pbuffer, but so far I haven’t been able to determine if
this capability is available under Linux using OpenGL on my card. (In
case you are wondering, this code will always run on the hardware that I
specify, so it doesn’t need to be platform/hardware independent. This
reduces it’s general interest, since most apps have to work well on all
sorts of hardware.)

I realize that this topic has moved away from SDL, for which I
apologise, but I’m sure some here know a lot about it. I’ve asked
similar questions on OpenGL and nVidia boards - fingers crossed.

Gib> Whatever smpeg does, mpeg4ip can be modified to do, as well. (that’s

where I took most of my calls as well).

Most video codecs decode into the YUV color space, so if you’re displaying
in RGB, you’ve got that step anyway (either the decoder does it while
decoding, or the renderer does the conversion).

Isn’t an overlay just that ? Can’t you overlay the YUV on top of your
OpenGL ? (These aren’t questions that I know the answers to, just ones
I’m asking).

Bill

Gib Bogle wrote:

Thanks Bill. I have installed mpeg4ip, and looked at the code. My
program does all graphics in OpenGL, therefore to play a video I have to
use texture mapping (as I do with smpeg). It seems that the important
line in the mpeg4ip code (for my purposes) is this line in
video_sdl.cpp:

rval = SDL_DisplayYUVOverlay(m_image, &m_dstrect);

which is where the frame finally gets displayed. I need to do this step
in OpenGL. I’ve been trying to find out about the YUV overlay, and I
don’t really grasp it, but it seems that the display of a YUV frame is a
video card function, which may mean that it can’t be done in OpenGL
except by resorting to a software conversion of YUV -> RGB, which
everyone says is a BAD THING. Is there a way to solve this?

thanks
Gib

You can look at mpeg4ip - it should play most divx videos.

http://www.mpeg4ip.net

Bill May

Gib Bogle wrote:

I learned how to use the smpeg library to play mpg videos within my
SDL/OpenGL application. Now I’m wondering if there is a library that
will enable me to play divx videos. Has anyone done this?

thanks
Gib

Hello!

Isn’t an overlay just that ?

It should be, but AFAIK SDL overlays
aren’t real overlays, just YUV surfaces.

Ciao,
Eike