How to play a DivX movie in SDL/OpenGL?

Hello!
Please help.
I need to play a DivX movie in the middle of my SDL/OpenGL program.

  1. How do I play DivX movies? I know there’s SMpeg, but I didn’t see
    examples of using it, and I’m not sure it can play DivX movies as well…

  2. Is there a way to play the movie without destroying and recreating
    the OpenGL context (I.e. not changing video to SDL surface, playing, and
    then changing to GL surface)? That is, seamlessly moving between the GL
    scene and the movie.

  3. The movie is encoded using DivX 5.0 Pro, but it should play on any
    computer, with other versions of DivX decoder or without it at all. Is
    there a way to include the decoder with my program (I’m using Delphi, so
    please no C++ static linking stuff), or do I have to install the DivX
    codec on the computer? If it’s the second case, how to I check the DivX
    existance and version?

10q,
RK.

Hello!
Please help.
I need to play a DivX movie in the middle of my SDL/OpenGL program.

  1. How do I play DivX movies? I know there’s SMpeg, but I didn’t see
    examples of using it, and I’m not sure it can play DivX movies as well…

Well… Can anything but one of these so called “DivX ;-)” codecs? AFAIK, the truly interesting versions are modified and won’t play with Microsoft’s official codecs.

Oh well - if you have the codec (and I think it’s available for various platforms, including Linux and Win32, of course), you can probably use the normal Win32 API for codecs - although that’s not quite my area. (Applies to Win32 as well as video, really.)

  1. Is there a way to play the movie without destroying and recreating
    the OpenGL context (I.e. not changing video to SDL surface, playing, and
    then changing to GL surface)? That is, seamlessly moving between the GL
    scene and the movie.

I’m afraid the only truly reliable way of doing that is to pipe a software codec into a procedural texture, and have OpenGL render that in whatever size you want.

The advantage is that you can have very smooth playback of low resolution videos regardless of screen resolution, as long as the video card fillrate is sufficient. Another advantage is that you can easilly combine the video playback with various OpenGL effects. (Something like those video clips on the credits screens in RTCW, for example.)

  1. The movie is encoded using DivX 5.0 Pro, but it should play on any
    computer, with other versions of DivX decoder or without it at all.

Without any DivX code at all? Hmm… :slight_smile:

Is
there a way to include the decoder with my program (I’m using Delphi, so
please no C++ static linking stuff), or do I have to install the DivX
codec on the computer?

I suppose the latter, unless you can find a usable DivX codec in the form of a handy DLL with a license you can deal with.

If it’s the second case, how to I check the DivX
existance and version?

That would be that Win32/video stuff I’m not at all into… :slight_smile:

//David

.---------------------------------------
| David Olofson
| Programmer

david.olofson at reologica.se
Address:
REOLOGICA Instruments AB
Scheelev?gen 30
223 63 LUND
Sweden
---------------------------------------
Phone: 046-12 77 60
Fax: 046-12 50 57
Mobil:
E-mail: david.olofson at reologica.se
WWW: http://www.reologica.se

`-----> We Make Rheology RealOn Thu, 13/06/2002 21:38:19 , Romi Kuntsman wrote:

I need to play a DivX movie in the middle of my SDL/OpenGL program.

  1. How do I play DivX movies? I know there’s SMpeg, but I didn’t see
    examples of using it, and I’m not sure it can play DivX movies as well…

Are you talking about DivX for Windows or for Linux? Implementations are quite different: win32 version is an avi codec, and I don’t know anything about it. Linux
version is a shared library with its own headers.

Well… Can anything but one of these so called “DivX ;-)” codecs? AFAIK, the truly interesting versions are modified and won’t play with Microsoft’s official codecs.

False. DivX :wink: 1-2-3 where illegal hacks of WMA. DivX 4 and 5 (without the :wink: ) are fully rewritten, fully legal stuff.

  1. The movie is encoded using DivX 5.0 Pro, but it should play on any
    computer, with other versions of DivX decoder or without it at all.

AFAIK, DivX 5 videos should work with DivX 4 or higher decoders. However, WHY BOTHER? Ship DivX with your program and, during installation, ask “DivX 5 is
necessary for the execution of MYAPP. Do you want to install it now?” No need for automatic detection. For windows version, just run DivX’s own installer. For linux
version, run the install.sh script provided with the package.

CRV?ADER/KY
KnowledgE is PoweR

CRV?ADER/KY wrote:

I need to play a DivX movie in the middle of my SDL/OpenGL program.

  1. How do I play DivX movies? I know there’s SMpeg, but I didn’t see
    examples of using it, and I’m not sure it can play DivX movies as well…

Are you talking about DivX for Windows or for Linux? Implementations are quite different: win32 version is an avi codec, and I don’t know anything about it. Linux
version is a shared library with its own headers.

Implementations are different, but hopefully there’s a similar
interface. That’s what SDL is for graphics - same interface on different
implementations.
So where’s that interface? I assume it’s SMpeg, so if it is, please show
me how to use it.

  1. The movie is encoded using DivX 5.0 Pro, but it should play on any
    computer, with other versions of DivX decoder or without it at all.

AFAIK, DivX 5 videos should work with DivX 4 or higher decoders. However, WHY BOTHER? Ship DivX with your program and, during installation, ask “DivX 5 is
necessary for the execution of MYAPP. Do you want to install it now?” No need for automatic detection. For windows version, just run DivX’s own installer. For linux
version, run the install.sh script provided with the package.

OK…
So:

  1. How do I get a DivX decoder that I can ship with my program? I need
    it’s lisence to allow distribution with my program, and to be only the
    decoder and not all the other stuff like encoder, player, tools, etc.
  2. How do I actually play DivX movies from my program???
  3. Even without automatic detection, I still need a basic check in my
    program to see if DivX is installed or not. I always program carefully
    and check stuff the might seem ovbious and useless to check for others.
    So even though it might be useless to check if it’s installed, since it
    would be installed in my app’s installer, I want to check anyway.

RK.

I need to play a DivX movie in the middle of my SDL/OpenGL program.

  1. How do I play DivX movies? I know there’s SMpeg, but I didn’t see
    examples of using it, and I’m not sure it can play DivX movies as well…

Are you talking about DivX for Windows or for Linux? Implementations are quite different: win32 version is an avi codec, and I don’t know anything about it. Linux
version is a shared library with its own headers.

You could use the “linux” version to be outputting the frames. Which would work
in any operating system. (Assuming, of course, the library isnt doing anything
from keeping us from compiling in win32)

Well… Can anything but one of these so called “DivX ;-)” codecs? AFAIK, the truly interesting versions are modified and won’t play with Microsoft’s official codecs.

False. DivX :wink: 1-2-3 where illegal hacks of WMA. DivX 4 and 5 (without the :wink: ) are fully rewritten, fully legal stuff.

Wrong. It is a perfectly legal hack of Microsoft’s MPEG-4 codec. (MPEG-4 is not
the windows media format)

  1. The movie is encoded using DivX 5.0 Pro, but it should play on any
    computer, with other versions of DivX decoder or without it at all.

AFAIK, DivX 5 videos should work with DivX 4 or higher decoders. However, WHY BOTHER? Ship DivX with your program and, during installation, ask “DivX 5 is
necessary for the execution of MYAPP. Do you want to install it now?” No need for automatic detection. For windows version, just run DivX’s own installer. For linux
version, run the install.sh script provided with the package.

Yes, you should always be using the newest divx. Also, I wouldnt be playing
divx5 movies with anything but divx5 and above, otherwise you might get very
degraded playback.

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)On 16-Jun-2002, CRV?ADER/KY wrote:

CRV?ADER/KY
KnowledgE is PoweR


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." --Kristian Wilson, Nintendo, Inc, 1989

[…]

  1. How do I get a DivX decoder that I can ship with my program? I need
    its licence to allow distribution with my program, and to be only the
    decoder and not all the other stuff like encoder, player, tools, etc.

Well you can download the decoder/encoder from www.divx.com. Check out the license but I think that you can
implement it for free. You can separate decoder from encoder in linux distro, but you can’t do that in windows.
However, it’s just 3.1 mb. (remember to provide the STANDARD and not the PRO version, as it can still read PRO
files but it’s ad-free - and you don’t want to install spyware on your customers PCs, do you?)

  1. How do I actually play DivX movies from my program???

I don’t know. In Windows, you could use a Media Player OCX/DLL. In Linux, you may use your own code to read the
container format (It’s AVI, isn’t it?) and then use the decore() function provided with DivX4Linux (always at
www.divx.com). By the way, WHICH OS ARE YOU RUNNING ON?
That’s a question for me: I’ve got to create a DivX AVI file from SDL_Surfaces. I can’t create BMPs and then
use an AVI generator since it would take several GBs. How can I do that? I can use Windows OR Linux (I need to
create a presentation so it has to work only on my PC).

  1. Even without automatic detection, I still need a basic check in my
    program to see if DivX is installed or not. I always program carefully
    and check stuff the might seem ovbious and useless to check for others.
    So even though it might be useless to check if it’s installed, since it
    would be installed in my app’s installer, I want to check anyway.

In linux, check for the existance of /usr/local/lib/libdivxdecore.so
Sorry but I know really few about codecs in Windows.

CRV?ADER/KY
KnowledgE is PoweR

I need to play a DivX movie in the middle of my SDL/OpenGL program.

  1. How do I play DivX movies? I know there’s SMpeg, but I didn’t see
    examples of using it, and I’m not sure it can play DivX movies as well…

Are you talking about DivX for Windows or for Linux? Implementations are quite different: win32 version is an avi codec, and I don’t know anything about it. Linux
version is a shared library with its own headers.

Well… Can anything but one of these so called “DivX ;-)” codecs? AFAIK, the truly interesting versions are modified and won’t play with Microsoft’s official codecs.

False. DivX :wink: 1-2-3 where illegal hacks of WMA.

Ah, I see. (I knew they were illegal, though…)

DivX 4 and 5 (without the :wink: ) are fully rewritten, fully legal stuff.

Not up to date enough to know about those, I think. (As I’ve suggested, video is not my really cup of tea… :slight_smile:

//David

.---------------------------------------
| David Olofson
| Programmer

david.olofson at reologica.se
Address:
REOLOGICA Instruments AB
Scheelev?gen 30
223 63 LUND
Sweden
---------------------------------------
Phone: 046-12 77 60
Fax: 046-12 50 57
Mobil:
E-mail: david.olofson at reologica.se
WWW: http://www.reologica.se

`-----> We Make Rheology RealOn Sun, 16/06/2002 23:23:05 , CRV?ADER/KY wrote:

[…]

False. DivX :wink: 1-2-3 where illegal hacks of WMA. DivX 4 and 5 (without the :wink: ) are fully rewritten, fully legal stuff.

Wrong. It is a perfectly legal hack of Microsoft’s MPEG-4 codec. (MPEG-4 is not
the windows media format)

Hmm… Is hacking Microsoft’s code legal now? (If it ever was illegal anywhere but in their fanatsy…)

Oh well.

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

That sounds like a good point to me. (Especially if you just want software rendering into an OpenGL texture. A plain library sounds like the right tool for that.)

//David

.---------------------------------------
| David Olofson
| Programmer

david.olofson at reologica.se
Address:
REOLOGICA Instruments AB
Scheelev?gen 30
223 63 LUND
Sweden
---------------------------------------
Phone: 046-12 77 60
Fax: 046-12 50 57
Mobil:
E-mail: david.olofson at reologica.se
WWW: http://www.reologica.se

`-----> We Make Rheology RealOn Sun, 16/06/2002 23:16:04 , Patrick McFarland wrote:

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

CRV?ADER/KY wrote:

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Use ffmpeg http://www.ffmpeg.org , this program/library has a very nice API
and allows to play mpeg1, mpeg2, divx, …

Bye,
Johns–
Become famous, earn no money, create music or graphics for FreeCraft RTS
http://FreeCraft.Org - FreeCraft a free real-time strategy game engine

Like I said earlier, why bother? Use the library form of divx for all
platforms. Its a bitch to try to get win32 codecs to work.On 17-Jun-2002, CRV?ADER/KY wrote:

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." --Kristian Wilson, Nintendo, Inc, 1989

Or that works. Yeah, ffmpeg is a good library, mplayer can use it (and most
people set it up to use it.)On 17-Jun-2002, Lutz Sammer wrote:

CRV?ADER/KY wrote:

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Use ffmpeg http://www.ffmpeg.org , this program/library has a very nice API
and allows to play mpeg1, mpeg2, divx, …

Bye,
Johns

Become famous, earn no money, create music or graphics for FreeCraft RTS
http://FreeCraft.Org - FreeCraft a free real-time strategy game engine


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." --Kristian Wilson, Nintendo, Inc, 1989

Yeah but what should I link with? Wich headers should I use? (the ones provided for Linux,
maybe?>On 17-Jun-2002, CRV?ADER/KY wrote:

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Like I said earlier, why bother? Use the library form of divx for all
platforms. Its a bitch to try to get win32 codecs to work.

You should link with the library, and use the headers that come with the
library. You keep thinking the library is linux only… its suppost to
be able to compile on any platform long as they didnt screw something up.On 18-Jun-2002, CRV?ADER/KY wrote:

On 17-Jun-2002, CRV?ADER/KY wrote:

[…]

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Like I said earlier, why bother? Use the library form of divx for all
platforms. Its a bitch to try to get win32 codecs to work.

Yeah but what should I link with? Wich headers should I use? (the ones provided for Linux,
maybe?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." --Kristian Wilson, Nintendo, Inc, 1989

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Like I said earlier, why bother? Use the library form of divx for all
platforms. Its a bitch to try to get win32 codecs to work.

Yeah but what should I link with? Wich headers should I use? (the ones provided for Linux,
maybe?

You should link with the library, and use the headers that come with the
library. You keep thinking the library is linux only… its suppost to
be able to compile on any platform long as they didnt screw something up.

What do you mean with “the library”, DivX.dll? How can I do that? (for example, using VC6 or Dev-C++?) Don’t I
need .lib or .a files?

Yes, dll. Just figure out how to compile it with gcc on win32, and tada, you
have a library that works. It isnt that hard to do.On 19-Jun-2002, CRV?ADER/KY wrote:

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Like I said earlier, why bother? Use the library form of divx for all
platforms. Its a bitch to try to get win32 codecs to work.

Yeah but what should I link with? Wich headers should I use? (the ones provided for Linux,
maybe?

You should link with the library, and use the headers that come with the
library. You keep thinking the library is linux only… its suppost to
be able to compile on any platform long as they didnt screw something up.

What do you mean with “the library”, DivX.dll? How can I do that? (for example, using VC6 or Dev-C++?) Don’t I
need .lib or .a files?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." --Kristian Wilson, Nintendo, Inc, 1989

Yes, dll. Just figure out how to compile it with gcc on win32, and tada, you
have a library that works. It isnt that hard to do.

With “compile it” do you mean “compile DivX” or “compile my application?” In the first case, should I remember
you that DivX is closed source?

I seriously recommend not using the win32 codec system. Its braindamaged, and
makes you have to write the code twice (once for win32, once everything else.)

If anyone knows how to directly access the DivX API in Windows, let me know. Thanks

Like I said earlier, why bother? Use the library form of divx for all
platforms. Its a bitch to try to get win32 codecs to work.

Yeah but what should I link with? Wich headers should I use? (the ones provided for Linux,
maybe?

You should link with the library, and use the headers that come with the
library. You keep thinking the library is linux only… its suppost to
be able to compile on any platform long as they didnt screw something up.

What do you mean with “the library”, DivX.dll? How can I do that? (for example, using VC6 or Dev-C++?) Don’t
I>On 19-Jun-2002, CRV?ADER/KY wrote:

need .lib or .a files?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Patrick “Diablo-D3” McFarland || unknown at panax.com
"Computer games don’t affect kids; I mean if Pac-Man affected us as kids, we’d
all be running around in darkened rooms, munching magic pills and listening to
repetitive electronic music." --Kristian Wilson, Nintendo, Inc, 1989


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

CRV?ADER/KY wrote:

[…]

  1. How do I get a DivX decoder that I can ship with my program? I need
    its licence to allow distribution with my program, and to be only the
    decoder and not all the other stuff like encoder, player, tools, etc.

Well you can download the decoder/encoder from www.divx.com. Check out the license but I think that you can
implement it for free. You can separate decoder from encoder in linux distro, but you can’t do that in windows.
However, it’s just 3.1 mb. (remember to provide the STANDARD and not the PRO version, as it can still read PRO
files but it’s ad-free - and you don’t want to install spyware on your customers PCs, do you?)

3.1MB seems very little if I would have been selling and distributing my
software on CDs or something, but I’m not.
My program is open source (QPL lisence) and meant to be downloaded from
the Internet. For that, 3.1MB is quite a big addition.
This is also why I’m using DivX – so that I could distribute
mini-movies (each one is a few minutes, but that still takes up a lot,
and especially all together) via the Internet (so that each one will
take maximum a few MB and not a few 10s of MB).
I guess I could just tell people to download and install the DivX
decoder from www.divx.com in order to run my program, just as I do about
SDL and other libraries…

  1. How do I actually play DivX movies from my program???

I don’t know. In Windows, you could use a Media Player OCX/DLL. In Linux, you may use your own code to read the
container format (It’s AVI, isn’t it?) and then use the decore() function provided with DivX4Linux (always at
www.divx.com). By the way, WHICH OS ARE YOU RUNNING ON?

I’m using Microsoft Windows XP. But I also have Linux, and want my
program to run there as well…

RK.