project-navigation
Personal tools

Author Topic: OGM Windows Support  (Read 5032 times)

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
OGM Windows Support
« on: April 27, 2009, 12:39:40 am »
Quote
currently ogm support is disabled in windows builds - i wasn't able to find (official) dll files for windows for theora and xvidcore - and there seams to be a problem in the vorbis dev archive i've added to the new codeblocks version ( http://mattn.ninex.info/download/codeblocks.zip )

Quote
we could really need some windows developer or user that is able to look into this.

I can help - I use both Windows and Linux, although Windows more, I know some stuff about video editing and codecs and such, although as far as programming I'm still rather new to C/C++ and the languages which aren't web-based (like Java and HTML, which I do know).

Quote
currently ogm support is disabled in windows builds - i wasn't able to find (official) dll files for windows for theora and xvidcore - and there seams to be a problem in the vorbis dev archive i've added to the new codeblocks version ( http://mattn.ninex.info/download/codeblocks.zip )

The Xvid issue is easy to answer - first off, the Xvid dev team doesn't release builds, only source code, however they link to and recommend people's sites that offer builds for Windows.  According to Koepi's site (one site they link to), Koepi offers two builds, one which is a plain, unmodified simple compile of the official code packaged with a simple installer, and another with some experimental add-on features.  The former, the unmodified one, contains the xvidcore.DLL file in the installer (I've used this particular installer many times before, I use Xvid a lot) so that DLL isn't hard to get.

As for theora, I've hardly ever touched that codec, but I'll look into it.

I'll also play with the codeblocks version you linked to and see what I can do with it.


BTW, As far as programs to encode OGM, I'd recommend Avidemux, an open-source program also on sourceforge that is also free and also cross-platform, plus has some editing features that are nice, and the input video can be almost any common format, unlike the RoQ tools which are a pain for the inexperienced.

Edit: The site with the unmodified, "vanilla" installer for Xvid on Windows (which contains the DLLs) is here:

http://www.koepi.info/xvid.html

« Last Edit: April 27, 2009, 07:11:12 pm by Mattn »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
OGM Windows Support
« Reply #1 on: April 27, 2009, 07:37:44 am »
thanks for the link - i've just commited the xvidcore.dll - do you think that this dll is enough to encode xvid files? there is also a xvid.ax file in windows/system32. is that file needed to? shouldn't we add it to the contrib/dlls dir but add the complete installer?

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
OGM Windows Support
« Reply #2 on: April 27, 2009, 03:58:22 pm »
Alright, I'll have to explain a few things here to try to answer your questions, I'll try to keep it to the short version, and if I cover something you already know, I apologize:

OK, first off, the Windows installer I linked to does a number of things, it does more than just un-pack the codec all by itself - It includes filters - both Directshow1 and Video-For-Windows2 that plug in to nearly any video editing software easily, which allow for both encoding as well as decoding Xvid video files.  It also sets up components so that Windows Media Player will easily play back Xvid videos - Right after running the installer, one could double-click on an AVI file encoded with Xvid and it would play, no extra mess or fuss.  As such, with these components it includes the xvidcore.dll, the xvid.ax file, and another dll file called xvidvfw.dll.  (I'm guessing the last one, xvidvfw.dll, is for the Windows-For-Video interface.)  The installer also includes a few other utilities for working with Xvid video files, little utilities which show up under the program menu from the Windows "start" button.

The goal we're trying to get to though - coding part of a C application (the UFO:AI game) to simply use the proper DLL files to internally support cinematic playback with its own internal player - is a little different though and doesn't require all of those components that the Xvid installer sets up.

xvidcore.dll I'm sure will certainly be needed, I'm not sure if xvidvfw.dll would also be necessary as xvidvfw.dll is probably for the Windows-specific Video-For-Windows interface which I don't think UFO:AI would need to access - I don't know the details of how the internal video player in the game works, but if I had to guess I'd say "no."

As for the xvid.ax file, if I have my information straight I believe that has to do with allowing Windows Media Player to automatically find the codec as well as Video Editing software (such as Vegas, Premiere, Video Studio, etc.).  I'm guessing we would not need that file.

Including the entire Xvid installer IMO is a bad idea, the same goes for integrating it with the game installer.  Doing so would mean installing codec components that would affect operation of other software on Windows - which is bad because it would not be self-contained to just the game - and also because the end-user may already have a different version of Xvid already on their system from a codec package, an Xvid installer, or some other software.  (This would mean it could mess up Windows Media Player and video editing apps for the end-user).  Needless to say, if the full Xvid installer was put into the game we would get lots of nasty feedback from gamers who tried the game and complained about how it messed up their video editing apps or playback of video on their system.

In light of these points, I'd say include just the xvidcore.dll, at least for now, and add other things as needed.

You also asked:

Quote
...do you think that this dll is enough to encode xvid files?

If you want to "encode" or create Xvid files as well as play them back in-game, that's a little bit different.  If you want to get into that, for example, to record game sessions and demos, I'd suggest looking into adding a library called REVEL, which I think stands for Really Easy Video Encoding Library.  REVEL is a free, open-source (it's also on sourceforge) C/C++ library that works with Xvid for creating video files in a C or C++ application.  I glanced at the API and docs once, the only issue is that it isn't fully up-to-date to work with the latest version of Xvid.  I've heard from people who have tried REVEL that if you can get it to work its kind of cool for recording game sessions and demos, so you don't have to use separate screen recording software.

1 Directshow is one type of interface for video playback on Windows, it is what standard Windows Media Player and some video editing software apps (both commercial and free ones) use.
 
2 Video For Windows is an older interface for video playback on Windows, going back to Windows 98 SE, but still used by many modern video editing apps, such as VirtualDub, as well as some commercial ones.

Edit: Is SDL used for Video in the game?  I know its used for audio...

P.S. Perhaps we should split this thread and continue this discussion in the "Coding" section, under "Adding OGM Support" or some other appropriate title, as this goes off-topic from an introduction animation and is getting technical.
« Last Edit: April 27, 2009, 04:03:12 pm by Destructavator »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
OGM Windows Support
« Reply #3 on: April 27, 2009, 07:07:56 pm »
As for the xvid.ax file, if I have my information straight I believe that has to do with allowing Windows Media Player to automatically find the codec as well as Video Editing software (such as Vegas, Premiere, Video Studio, etc.).  I'm guessing we would not need that file.

ah ok - didn't know that. thanks

Quote
Edit: Is SDL used for Video in the game?  I know its used for audio...

yes

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
Re: OGM Windows Support
« Reply #4 on: April 27, 2009, 10:22:49 pm »
OK, I did a little more research and stuff, it look a bit of work as the Xvid creators don't explain use of their codec very well and don't publish an API on their website, from what I found most of their development links are not for developing apps that use their codec, but they really seem to encourage programmers to develop the codec itself.

It seems I was right in a few of my past statements:  The only DLL we need is xvidcore.dll, we don't need the "vfw" one and we don't need the ".ax" file for the game.

We do, however, apparently need some source header files in addition to the xvidcore.dll file if I read their site correctly.  These files that include the "xvid.h" etc. are in the source package which I'll attach to this post.

I found the C file "cl_cinematic_ogm.c" in the game's source, as well as the one for RoQ videos as well.  I haven't tried modifying anything in codeblocks yet - to be honest I haven't looked at most of the game's C code, but I'd imagine these files could be worked in to hopefully get (OGM) video playback on Windows working.  I'm not sure exactly where HAVE_XVID_H is defined, and I'm not going to pretend to be any expert at Codeblocks and C/C++, but I'm working at it.

P.S. - For any programmers here who know this stuff better than I do, if I'm dead wrong about anything at any time, feel free to correct and humiliate me...   :P

[attachment deleted by admin]
« Last Edit: April 27, 2009, 10:25:15 pm by Destructavator »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: OGM Windows Support
« Reply #5 on: April 28, 2009, 07:27:00 am »
you have to define HAVE_VORBIS_CODEC_H HAVE_XVID_H and HAVE_THEORA_THEORA_H in the build options (there is a define tab) in order to build with ogm support. it's automatically detected on a *nix system (or msys system) but not for codeblocks. the code for using the xvid codec is already done - that's not my concern. it's just about the windows integration. we only need the xvidcore.dll and a theora.dll (or whatever the name is). and it seams that the vorbis package that i've added to the codeblocks archive doesn't link.