Game Development Community

Theora Bug

by Travis Mallett · in Torque Game Engine · 03/10/2006 (5:16 am) · 21 replies

I am having difficulties getting the Theora control to work in Torque 1.4. My video plays fine the first time. Subsequent replays cause the player to play as if in slow motion without audio. It almost looks as if you were downloading a video file and playing it before the buffer was completely full. I've seen other threads where this was a problem in early Torque 1.4 releases. However, I am using the latest official release and this is still a problem. Early release candidates had fixed this issue but at that time Torque 1.4 release candidates were not using mutexes. Any suggestions?

About the author

Recent Threads

Page «Previous 1 2
#1
02/20/2007 (8:24 pm)
Hi james

I'm also getting this issue. I've been noodling around with the Theora code for a couple of days without much success. Did you ever workout a solution. I've worked out that it is only an issue with Theora files with an audio track.

Cheers


Tim
#2
02/20/2007 (8:26 pm)
Hi james

I'm also getting this issue. I've been noodling around with the Theora code for a couple of days without much success. Did you ever workout a solution. I've worked out that it is only an issue with Theora files with an audio track.

Cheers


Tim
#3
03/20/2007 (6:26 am)
We seem to get this, but it appears to be machine-based (ie. video/audio card issues). Our stuff runs perfect on some machines, but not on others.

Unfortunately I don't have the time to muck with it at the moment due to deadlines...
#4
03/20/2007 (7:00 am)
This is the second post. Please see

www.garagegames.com/mg/forums/result.thread.php?qt=52898

for a temporary solution.
#5
03/20/2007 (7:03 pm)
I've posted a reply on that thread.
#6
04/18/2007 (4:43 am)
This is a followup from Dale's post....


Well, the *temporary solution* still didn't want to work on some of our machines.

So what we ended up doing instead is to get the "guiAviBitmapCtrl" up and running again (with help from a thread on that topic.. can't remember the link unfortunately...), and adding the functionality for looping videos on it. So instead of a single video/sound OGG file playing through the Theora controls, we stream separate AVI (video) and OGG (sound) files through the AVI controls.

It took us a little time to play with a good compression and format for the AVI, but we ended up with something that looks just as good as (if not better than...) OGG, and is only 20% or so bigger. The files are synced and stream perfectly, with no lagging at all, and we've had them looping for over 72 hours with no ill effects, so if anyone out there is still having issues with the Theora video streaming, I strongly suggest that they go the AVI route (as long as you are willing to invest a bit of time in finding a codec/compression that you are happy with!).
#7
05/19/2007 (7:00 am)
Just to let anyone else know that's having trouble. We too have terrible framerate issues on some machines with theora video on our maingui.gui. It works fine on some PCs, although it hits framerate anyhow down to around 40 to 50 frames when the video is playing, but some PCs go down to 2 fps in the gui depending on their Video / soundcards. I'm going to look into the guiAviBitmapCtrl instead. Thanks for the info. to all above, but it looks like theora is not an option as far as we're concerned.
#8
05/19/2007 (5:57 pm)
One thing I found is that if you install the newest openal drivers on all of the machines.(As well as the dll in the games folder which I'd forgot), things work a lot better, this could account for the variabilty on your machines. This along wth the safety check fix has made Theora a lot more stable than I thought it was, I can know play multiple videos and repeat them etc with without any frame drop, any the audio stays in sync.

I just took a while to get there!


Tim
#9
05/20/2007 (12:26 pm)
Right, sounds interesting. I've also dropped the audio from our Maingui.gui .ogg and used a .wav for the music instead, I'm going to do more tests before going down the .avi route as I'm having real trouble keeping the file size/compression as good.
#10
05/25/2007 (1:04 am)
Right, I've done loads of tests. I'm still getting a framerate / quality balance problem.

Does anyone have any details of the biggest video they've managed to get working at a decent framerate and compression in the gui? I'm trying to run a 6 second long 640x480 looping .ogg video with no sound in the file. Does the video have to be any particular ratio? Is it any better to the power of 2, ie. 512x512? Idealy a video of 800x350 is what I need but I'm unsure if this is too big etc. etc. Any suggestions on bitrate? I'm using the converter off the theora site by the way. Cheers,
#11
05/25/2007 (1:24 am)
Our AVI is a 69 second, 512x384 video, 25fps, compressed with Indeo video 5 (not sure on the actual internal compression settings like bitrate, etc. as it was another guy here who did it but isn't around today...). It is *only* 17.7MB (sound is a separate 1.07MB OGG).

;)

That gave us no problems. We never tried a higher res AVI, but I do remember trying higher res versions of our OGG (before we noticed the issues on different machines), and we did run into issues with ones that were too high res and had too high of a bitrate setting...

Sorry for the vagueness there, but we have totally cut ties with doing OGG videos so we don't have any of our old stuff around anymore for reference as to what we actually did :)
#12
05/25/2007 (1:44 am)
Ok, as for the AVI settings that we used I just found out more info on them. Our guy used Virtual Dub (not something that most people have, so I'm not sure what equivalents in other programs may be...), and he used Ligos Indeo 5.2 with 90% quality (for a good balance between size/quality for us).

He did however also do a version of the movie using the WMV9 codec at 95% which looked *WAY* better than the Indeo one, and was only 13MB compared to 17.7MB. However, it didn't want to play on some machines (which is weird as it did have WMV9 installed on it...) so we never actually used that version in the game (other than to test and see that it did work on some machines). We probably will go back to WMV9 when we ship once we take the time to figure out what we need to provide in our installer for machines that may not have that codec, as that WMV9 one looked as good if not better than our OGG, and it was nearly the same size (I think the OGG that we *had* used in the past was about 11.5MB or so...).
#13
05/25/2007 (5:08 am)
Thanks for all this info. Luke...

So do you really think the old AVI control is the way to go then? I'm getting two conflicting ideas here by the look of things, one going down the AVI route and the other one the .ogg with no sound, and sound as a .wav......this is all cool as long as I can get to the bottom of which one is the Daddy and all that.

...so....I'll carry on testing to see what quality I can get with both .ogg and .avi , both without sound etc. What kind of framerate are you getting your GUI screen running when your video is in there if you don't mind me asking? If you have a 25fps video running, does the GUI run at 25fps for example or can it go higher? I'm just trying to figure out why I can get such low framerates ie. under 5 fps on a 2 Mb video file, seems crazy really.

Does the AVI stuff work out of the box in Torque? I'll try some AVIs next week and see if I have more luck with them.

It's mad it's so difficult to just run a video in the background of your front end. Mine only takes up about the bottom 1/3 of the screen, is only 6 seconds long and has to loop. I want it to look good at any res. and that's the brief, thats all... I'll keep plugging away at it.

Thanks so much again for the help

H.
#14
05/25/2007 (7:08 am)
For us, the AVI control was the best solution for us, as we didn't have time to mess around with broken OGG stuff and try to find out why things worked on one machine and not another. The quality that we get is more than enough for our purposes (although as I said, it took a bit of playing with :)).

With fraps running on my laptop (centrino duo 2GHz, Radeon X1600) I get 180fps in 1440x900, and about 210fps in 1024x768 with our intro movie running in the GUI (AVI video + OGG soundtrack).

AVI does need some tweaks to get it working... as i said above, there was a little resource made by someone that addressed the issues needed to get it working (some very minor stuff). I also tweaked a few more things to allow for it to loop, and maybe something else... As this *is* a private SDK forum, I take it that I would be able to post these fixes here? I'm running off to the airport now to drop some coworkers off, but I can paste our code changes tomorrow morning when I come into the office (deadline crunch :)), which will be about 18 hours from now (not sure where in the world you are...).

Yeah, there is a lot of madness happening in Torque! It definitely has some really good stuff going for it, but it also has quite a few "gotchas" ;)

I think that the community as a whole needs to start up a nice "Known Issues and Things that Torque isn't Good at" FAQ in order to help others not end up wasting so much time on things that just aren't feasible or don't work properly within Torque.
#15
05/25/2007 (9:32 am)
That would be amazing if you could post any help. If you don't want to post in a forum you could always drop me a mail at harvey@stickmanstudios.co.uk . I'd seriously appreciate it. I'll let you know any findings I have etc etc. and test it all out etc. Great stuff!
#16
05/26/2007 (1:12 am)
Ok... here are the changes that I've made to the guiAviBitmapCtrl are twofold. The first part of the changes are documented in the following thread by Richard 0:

www.garagegames.com/mg/forums/result.thread.php?qt=6038


There were a few bugs/incomplete things in that thread though, so I will still post my complete revisions below (but I did use that resource as a start, so credit where credit is due!), along with my script additions and my looping functionality changes

Oh, and remember that these are Win32 only changes!!!!



Ok, for guiAviBitmapCtrl.h:


Line 9:
-Change:

#if !ENABLE_AVI_GUI || !ENABLE_MPG_GUI

to

#if !ENABLE_AVI_GUI && !ENABLE_MPG_GUI


Now for guiAviBitmapCtrl.cpp:

Line 21:
-Change:

#define  ENABLE_AVI_GUI    0

to

#define  ENABLE_AVI_GUI    1


Line 44:
-Change:

#if !ENABLE_AVI_GUI || !ENABLE_MPG_GUI

to

#if !ENABLE_AVI_GUI && !ENABLE_MPG_GUI


Change the "sndOpen()" & "sndStart()" functions from:

bool GuiAviBitmapCtrl::sndOpen()
{
   mAudioLatency = 0;


   #if 0
   // streaming disabled in this build


   // Open up the audio.  Taking the easy way and using two separate streams.
   // Don't treat as error if it doesn't open-
   dSprintf(fileBuffer, sizeof(fileBuffer), "%s", mWavFilename);
   Audio::Description desc;
   desc.mIs3D = false;
   desc.mVolume = 1.0f;
   desc.mIsLooping = false;
   desc.mType = Audio::MusicAudioType;
   mWavHandle = alxCreateSource(&desc, fileBuffer, 0);
   #endif

   mWavHandle = NULL_AUDIOHANDLE;
   // alxGetContexti(ALC_BUFFER_LATENCY, &mAudioLatency);

   return (mWavHandle != NULL_AUDIOHANDLE);
}

void GuiAviBitmapCtrl::sndStart()
{
   if (mWavHandle != NULL_AUDIOHANDLE)
      alxPlay(mWavHandle);
}

to

bool GuiAviBitmapCtrl::sndOpen()
{
   char               fileBuffer[1024];
   Audio::Description desc;

   // Build the audio description
   desc.mVolume    = 1.0f;
   desc.mIsLooping = false;
   desc.mIs3D      = false;
   desc.mType      = 8;

   // Create the audio source

   dSprintf(fileBuffer, sizeof(fileBuffer), "%s", mWavFilename);

   mWavHandle = alxCreateSource(&desc, fileBuffer, 0);

   return (mWavHandle != NULL_AUDIOHANDLE);
}

void GuiAviBitmapCtrl::sndStart()
{
	if(mWavHandle == NULL_AUDIOHANDLE)
	{
		sndOpen();
	}

        if (mWavHandle != NULL_AUDIOHANDLE)
        {
		alxSetVolume(mWavHandle, 1.0f);
		alxPlay(mWavHandle);
         }
}


Line 194 (inside of "fileOpen()":
-Change:

rval = AVIFileOpen(&mPFile, mAviFilename, OF_SHARE_DENY_WRITE, 0);

to

rval = AVIFileOpenA(&mPFile, mAviFilename, OF_SHARE_DENY_WRITE, 0);


Around line 810 (inside of "movieStart()"):
-Add:
mDone = false;


-Also, inside of "onMouseDown()" and "onKeyDown()" I removed the calls to "movieStop()" but that will be an implementation specific thing for your needs



Now, to play the movie (with sound... can either WAV or OGG) from the script, my script looks like:

-GuiAviBitmapCtrl datablock

new GuiAviBitmapCtrl(FMV)
   {
      profile = "GuiDefaultProfile";
      horizSizing = "proportional";
      vertSizing = "proportional";
      position = "0 0";
      extent = "1024 768";
      visible = "1";
      done = "0";
      aviFileName = "./menus/fmv.avi";
      wavFileName = "./menus/fmv.ogg";
      letterBox = false;
      swapRB = true;
   };

-Play/management functions

function MovieLoopCheck()
{
   //handle infinite looping of the movie
   if(FMV.done)
   {
      FMV.stop();
      FMV.play();
   }
   $MovieLoopSchedule = schedule(33, 0, MovieLoopCheck);  
}

function MyGui::onWake()
{
   //rest of GUI onWake functionality...
   //...
   //...


   //set FMV Volume to be latest set through options (with whatever mType you have given the AVI in guiAviBitmapCtrl.cpp)
   alxSetChannelVolume(8, $pref::Audio::channelVolume[8]);
 
   FMV.play();
   $MovieLoopSchedule = schedule(33, 0, MovieLoopCheck);
}

function MyGui::onSleep()
{
   //rest of GUI onSleep functionality...
   //...
   //...


  //stop the FMV
   cancel($MovieLoopSchedule);
   FMV.stop();
}



And that should be about it! Hope it helps and good luck :)
#17
05/29/2007 (12:56 am)
Luke, that's fantastic, I'll get our guy to have a look at getting this in this week hopefully and let you know how we get on,

again, many many thanks!
#18
08/01/2007 (10:15 am)
I dont know why, but my guiAviBitmapCtrl dont have any method related to avi. It only have gamebase methods, anyone know why this is happening?
#19
08/01/2007 (10:22 am)
I believe the AVI resource has not been updated. Have you tried using Theora instead?
#20
08/01/2007 (11:59 am)
David Blake: Yes... im still trying, but im getting an error with it, the first movie play fine, but the second play reallly slow.

http://www.garagegames.com/mg/forums/result.thread.php?qt=52898
Page «Previous 1 2