Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Framerate problems and a Bug.  (Read 3455 times)

Bitplayer

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Framerate problems and a Bug.
« on: November 21, 2005, 11:06:39 AM »

Small bug.  Videos without audio can crash the plugin.  The problem is:
unsigned int TheoraAudioDriver::getAudioStreamWriteable()
   {
      unsigned int bytesEmpty = outFIFO.getWriteAvailable( );
      return bytesEmpty / bytesPerFrame;
   }
You will want to add a test for bytesPerFrame==0 before the division.

Framerate Problem

I get a framerate of 17fps on the CEGUI demo WITHOUT loading a video (in debug mode).  Videos play at about 5 fps and get pretty jumpy.  (They fall well behind the sound.)  This is on an XP, 2.4 GHZ Pentium, with an ATI X800 XL.  I get good frame rates with other OGRE programs and all of the demos.  I'm using a file that is 640x480 with compression by ffmpegtheora-0.15.  Is this normal?  I did see an OGRE forum entry that seemed to indicate the same problem.  The resolution was to remove CEGUI (???).  Any ideas?  Thanks.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Framerate problems and a Bug.
« Reply #1 on: November 21, 2005, 02:23:42 PM »

Hmm, well, without audio, I do not believe TheoraAudioDriver::getAudioStreamWriteable should ever be called... Seems, like the solution is not to check for 0, but to prevent that audio stuff from being called. The lib is a little dependent on audio as of now (definately a bug), which I planned to fix in the next video plugin.. Just, havn't had any time to work on a new plugin (which would fix many issues). If you find the root of the problem (why audio stuff is getting called at all with no audio), I would love a patch.

As for your other problem..hmm. 15 Fps without even loadiung any clips? wierd. How is the Ogre Cegui Gui Demo running? That would definately cause some sync issues with FPS that low. Also, your video of 640x480 is a little large. Remember that textures are scaled up by powers of two.. so, it becomes 1024x512. I would try to keep it down to a minimum of 512x512 (after scaling). Also, theora itself can be a little slow at decoding large videos.. It is not a heavily optimised codec like XVid.. And probably never will be, which is one reason I am looking for an alternative codec for my next lib. I would use XVid, if it were not GPL and also threatened by patents etc.
Logged

Bitplayer

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Yes, weird...
« Reply #2 on: November 21, 2005, 05:27:33 PM »

The GUI demo runs at 500fps, even with some anti-aliasing, at 1024x768.  I'll start chopping some pieces out to see if I can locate the problem.

Maybe the easiest thing to do with the div by 0 is to set a default bytesPerFrame value at 1.  If I stumble on the real cause, I'll let you know.

Thanks for responding.  Your work is much appreciated.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Framerate problems and a Bug.
« Reply #3 on: November 21, 2005, 07:54:16 PM »

Also, make sure that seeking is not enabled, and turn off the audio spectrum, and maybe even just remove all the little verticle bars from the demo.. as those eat away at CPU power. Also, make sure you are trying in release... Though, I have acceptable framerates (especially when no movie is loaded) in debug mode on my GF4 Ti4200 :/
Logged

Bitplayer

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Theora not doing well. Need advice.
« Reply #4 on: November 29, 2005, 05:14:32 AM »

I'm not having great success with Theora and the plug-in.  After removing the audio spectrum material my frame rate (in Debug, but that shouldn't matter much without watches or breakpoints) went up to 32 fps.  The rate drops to 11 fps when playing a movie.  That indicates the movie playing is using about 60 ms per frame.  This would limit any movie to under 16 fps.  Some of the problem may be with the converter I'm using.  It is ffmpeg2theora.  My AVIs play just fine using the VLC Media Player, but get choppy and slow after conversion to Ogg.  The compression from AVI is in the range of 10 - 16 to 1.  As far as I can tell, there are no other options.  With a 2.4 GHz Pentium and ATI X800 XL, I should have no problems playing a full size movie.  Certainly, I can play standard DVDs without trouble.

If someone has this system working well with OGRE with video files of 640 x 480 or something similar, I would like to know what converter they are using and the details of how it is being done.  I'm about to pass on Theora and just use DirectShow and some AVIs, since my requirements aren't that high.

To PJCast: how about a plugin that just plays AVIs using available codecs?

Thanks for any help.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Framerate problems and a Bug.
« Reply #5 on: November 29, 2005, 09:59:00 AM »

:arrow:
Debug and release build will *always* display significantly different framerates. You should always run benchmarks in release. Debug builds add alot, and I mean alot of overhead.

:arrow:
AVIs are no different to Ogg files in the basic sense. Both are just container formats. There layout and bit structures differ.
You can very well throw Mpeg, XVid, DivX, etc into an Ogg file (as is the case of OGM - ogg media file).
And, as far as those other codecs go... They are not free to use, royalty payments must be made (just like Mp3).. except in the case of using DirectShow, which MS alreasy paid a license for most codecs (except the ones the user may have installed). Though, DirectShow is not availiable on all platforms.

:arrow:
I already mentioned to that your video file dimensions are too much for the Video Graphics card and Theora itself - it is not heavily optimised. Try and keep them below 512x512. Also, what command line did you use when converting your files? To high of a video or audio quality setting is probably your problem.
Logged

Bitplayer

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Not good at an all quality levels.
« Reply #6 on: November 29, 2005, 05:40:18 PM »

Neither my program nor VLC can play my converted files (at quality levels 1, 4, 10, and the default and a size of 320x240) without very low frame rates and many dropped frames.  VLC plays the original 640x480 AVI without trouble.  If it isn't the converter, then I have to suspect Theora.  The alternative is a problem with both VLC and your code -- though I can't see any problem that would cause such slow decoding.  Saying this is due to Debug mode or texture size (when I have tried 320x240) doesn't explain the fact that I see almost identical performance in the CEGUI demo and VLC.  I've tried several different files with the same result.  I couldn't download your example.

Perhaps there is something about the AVI files that I have that gives Theora trouble.  If you have an Ogg/Theora file of reasonable size (say 320 x 240 at least) that will play at a good frame rate I would love to get a copy.

Thanks for all of your help and time.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Framerate problems and a Bug.
« Reply #7 on: November 29, 2005, 07:38:36 PM »

Sorry about the sample files... Seems that the file downloads got messed up during the webhost transfer... hmm, anyway.. you can access the files directly at http://www.wreckedgames.com/files/cheer.ogg

THe comment I made about debug and release build is just a statement of fact. Not discounted anything you may/might have seen. But, debug builds will always run slower than release builds. So, any issues of performance should be discussed about the release build :wink:

Perhaps you could send me the file of yours, both enocded into theora format and in the native format you had it in before conversion. I have some expereince with converting files, I think perhaps just some setting tweaks. Let me know how that cheer.ogg works for you too. It is not in color, but that doesn't matter speed should be the same as with a color video.

VLC and my code use the same theora codec - which is not at all optimised, so I would expect similiar results.
Logged

Bitplayer

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Your file played OK
« Reply #8 on: November 30, 2005, 03:54:53 AM »

The compression is very, very high.  (About 20 seconds/MByte)  Theora seems to have some problem with higher bandwidth and larger files.  I suspect that it is highly optimized for extreme levels of compression (and low quality) and breaks down at lower levels of compression.  This might be the case if it is primarily designed for streaming video over the web.

I have alternatives for my project, so I'm going to move on now.  Thanks for all of your time and help.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Framerate problems and a Bug.
« Reply #9 on: November 30, 2005, 08:52:10 AM »

Theora is not inherently designed for streaming.. The ogg bitstream is designed for streaming, but that has no earing on theora. As I said, theora is not optimised at all really.. It has no assembly, no MMX, no SSE, etc etc (except if you try the experiemental builds) - I know for a fact, as I ported theora itself to c# pretty straightforward and did not have to worry about trying to integrate that to c#.

But, if you found something better than go with it.. theora is not the best. Though, I would love to know what you are using.
Logged

Bitplayer

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Just going with DirectShow
« Reply #10 on: November 30, 2005, 12:06:07 PM »

My project is on a PC, so I can use DirectShow with one of the standard Microsoft codecs.  (I'm doing a Game Demo.)  These codecs aren't fast or efficient, but they will show a 640x480 30fps video on a reasonably fast PC without trouble.  In fact, the simple "Cutscene" player in DirectShow will play a 640x480 AVI on my machine without any problems.

Anecdote:  Six years ago I needed a codec for a game.  With the slow computer speeds in those days, there wasn't much available that didn't cost more than I could afford.  I made my own by using the Intel JPEG codec as a video codec.  I compressed each frame from a video sequence and combined the series into a file.  MPEG2 video does something similar, but it adds frame to frame compression.  I added in WAV file information and Viola! -- instant movie player.  If I have to, I'll go back to that.  It worked surprisingly well back then.  Intel's jpeg software is/was highly optimised -- so I think that with the computer speeds of today, this could make a decent codec.  In fact, I'm pretty sure it could sail past Theora.  But it is x86 only.
Logged