Game Development Community

Game crashes playing my video file

by Vlad I · in Torque Game Builder · 08/24/2012 (11:59 am) · 20 replies

I'm trying to play a video file I made and as soon as I hit play it crahes.
It doesn't even play it just a black screen.
I was following this link www.garagegames.com/community/forums/viewthread/128532

Could this be because of the video card or something else?

Anyone wants to test my video file? www.filedropper.com/3_13

thnx

#1
08/24/2012 (8:55 pm)
Somehow it started playing my video only with a bug, also as soon as I close the console it crashes.

Here is the screen of the video bug, what gives?
Does it need a specific resolution?
oi47.tinypic.com/2eoijjq.jpg
oi47.tinypic.com/2eoijjq.jpg
#2
08/26/2012 (2:05 am)
I don't understand what went wrong, but even the bugged videos stopped showing , while the console says it does.

Here is what I did :

I created MyVideo.gui in /game/gui and put this code in it

//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiTheoraCtrl(MyVideo) {  
          profile = "GuiDefaultProfile";  
          horizSizing = "relative";  
          vertSizing = "relative";  
          position = "0 0";  
          extent = "1024 768";  
          minExtent = "8 2";  
          visible = "1";  
          done = "0";  
          stopOnSleep = "1";  
          backgroundColor = "0 0 0 255";  
       };  
         
new GuiButtonCtrl(stopButton){  
      profile = "GuiButtonProfile";  
      horizSizing = "relative";  
      vertSizing = "relative";  
      class= "introVideo";  
      position = "0 0";  
      extent = "25 25";  
      minExtent = "8 2";  
      visible = "1";  
      Command = "stopVideo();";  
   };  

//--- OBJECT WRITE END ---

When I run my game level I hit console and paste this line to play the video:

MyVideo.setFile("game/data/video/3.ogg");

it doesn't play it but the console shows:

TheoraTexture - Loading file 'game/data/video/3.ogg'
Ogglogical stream 2f56 is Theora 272*400 30.00 fps video
-Frame content is 269*385 with offset (0,6),

As soon as I close the console the game crashes.

Are you only allowed to play videos between the levels?
I don't know what else I can try.
#3
08/26/2012 (8:42 am)
I tried looking at the source code and unfortunately the console doesn't say anything if it has crashed AFTER it spits out that promising text you mentioned.
Does the game continue to play after you start the video or does it just hang? See, if it still runs you can have this function "MyVideo.getCurrentTime()" and see if the video is progressing but not rendering.

EDIT: BTW, what program did you use to make that video? Apparently I have nothing on my computer that can play it properly so it shows up as chaotic colors vaguely in the shape of a humanoid walking...
#4
08/26/2012 (9:29 am)
Alpha thanks very much for testing it.

Quote:EDIT: BTW, what program did you use to make that video? Apparently I have nothing on my computer that can play it properly so it shows up as chaotic colors vaguely in the shape of a humanoid walking...

Weird. I can't watch my video now at all, it just crashes my windows media player.
I made the animation in 3ds Max as .avi and converted it with ffmpeg2theora into .ogg

Converting it into .ogg is a real pain in the ass. Do you know a proper procedure of doing it?

If I use my video file, I use the console to start it playing, the console shows what I wrote in the previous post, doesn't show any video, and when I close the console it crashes.

But if I use another video file www.dreambuildrepeat.com/GG/example.ogg
It doesn't crash the game when I close the console but also does not show/play it, the console shows some:

TheoraTexture - Loading file 'game/data/video/example.ogg'
Ogglogical stream 74aa is Theora 400*304 29.97 fps video
-Frame content is 400*300 with offset (0,4),
Ogglogical stream 5e7 is Vobris 2 channel 22050 Hz audio


Let's assume my video is somehow bugged.
Then why the other one doesn't play.

As for the scripting it, did I do it right?

What is the way of setting it up?
#5
08/26/2012 (10:30 am)
Alpha

Can you play this file on your computer?
I reconverted it and it plays on mine.

www.filedropper.com/4_7
#6
08/26/2012 (10:34 am)
Ok, it looks like the previous file was somehow badly converted, the new one the one in the previous post is a good one.

I tried it to play in my game and it won't play it, however after closing the console it no longer crashes the game. Some progress huh.
#7
08/26/2012 (10:43 am)
I downloaded VLC and I can play the original and your new one. The video looks pretty good btw.

I'll make a new torque project and see if I can get one of your videos to work in a testing arena, I can only do so much on speculation. I get back to ya.
#8
08/26/2012 (10:50 am)
Oh btw if you want to play ogg files and bunch of others in you rwindows media file or other players you may want to install their official codecs www.xiph.org/dshow/
Sorry forgot to mention this in the first place.
#9
08/26/2012 (11:07 am)
GOT IT! The video works flawlessly with this code
%guiContent = new GuiTheoraCtrl(MyVideo) {
  profile = "GuiDefaultProfile";    
  horizSizing = "relative";    
  vertSizing = "relative";    
  position = "0 0";    
  extent = "400 400";    
  minExtent = "8 2";    
  visible = "1";    
  done = "0";    
  stopOnSleep = "1";    
  backgroundColor = "0 0 0 255";    
};   
Canvas.addGuiControl(MyVideo);
MyVideo.setFile("game/data/video/4.ogv");

I'm not sure what you have but perhaps all you where missing was adding the control to the Canvas?
EDIT: Or perhaps you should have it .ogv not .ogg.
#10
08/26/2012 (11:15 am)
How did you make it work?

I still can not play it. Here is what I have in my MyVideo.gui:

//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiTheoraCtrl(MyVideo) {  
          profile = "GuiDefaultProfile";  
          horizSizing = "relative";  
          vertSizing = "relative";  
          position = "0 0";  
          extent = "1024 768";  
          minExtent = "8 2";  
          visible = "1";  
          done = "0";  
          stopOnSleep = "1";  
          backgroundColor = "0 0 0 255";  
       };  
Canvas.addGuiControl(MyVideo);  
MyVideo.setFile("game/data/video/4.ogg");  
         
new GuiButtonCtrl(stopButton){  
      profile = "GuiButtonProfile";  
      horizSizing = "relative";  
      vertSizing = "relative";  
      class= "introVideo";  
      position = "0 0";  
      extent = "25 25";  
      minExtent = "8 2";  
      visible = "1";  
      Command = "stopVideo();";  
   };  

//--- OBJECT WRITE END ---
And then I run my level.
#11
08/26/2012 (11:19 am)
changing .ogv to .ogg makes no difference, no video play.
#12
08/26/2012 (11:25 am)
Put it in an executable event like onLevelLoaded. You could make a object JUST for this video to handle that. When not in a function like that it crashes my project too.
#13
08/26/2012 (11:38 am)
Honest God :) I can not make it play even with onLevelLoaded object, it does look like it plays when the level is loaded you can see the console shows some stats.

Where do you put your code to?
#14
08/26/2012 (11:59 am)
Instead of trying to bumble through and explain it all I zipped up the skeleton project so you can download it and perhaps figure out what you need from it.
www.filedropper.com/videotesting
If this doesn't work then... I don't know. :S
#15
08/26/2012 (12:10 pm)
It works thnx a lot !!!

Instead of puting the code

%this.enableUpdateCallback();
	%guiContent = new GuiTheoraCtrl(MyVideo) {
          profile = "GuiDefaultProfile";    
          horizSizing = "relative";    
          vertSizing = "relative";    
          position = "0 0";    
          extent = "400 400";    
          minExtent = "8 2";    
          visible = "1";    
          done = "0";    
          stopOnSleep = "1";    
          backgroundColor = "0 0 0 255";    
       };    
		Canvas.addGuiControl(MyVideo);
   
	new GuiButtonCtrl(stopButton){    
      profile = "GuiButtonProfile";    
      horizSizing = "relative";    
      vertSizing = "relative";    
      class= "introVideo";    
      position = "0 0";    
      extent = "25 25";    
      minExtent = "8 2";    
      visible = "1";    
      Command = "stopVideo();";
into my .cs file I was putting it into MyVideo.gui as I mentioned in previous posts. :)

Alpha do you know how to play this video in a small screen so I could see my game around it.

I made this video to test if I could some how make a video with transparency , I want the black part to be canceled out and transparent.
#16
08/26/2012 (1:01 pm)
I don't know how to do either of those things and the source code isn't going to give up it's secrets easily. I'll look into it but I really don't know how much I can do. I'm glad we got the video to work at all.
#17
08/26/2012 (1:27 pm)
Yes, thanks again, and you were right about adding the Canvas.addGuiControl(MyVideo);
without it it doesn't show the video.

I searched the entire forum and documentation there is no description of the values of GuiTheoraCtrl at all.

I've tried to change extent and positioning with no avail.

Just one more question, when you play my video is it all the way stretched to the borders of the screen?
#18
08/26/2012 (1:33 pm)
Indeed. It doesn't look that bad, it just makes the...thing look shorter. Maybe you have to save the video to fit torque since torque wont change it's size.

Which manages to raise another question I'll look into, how to change the over all window size...
#19
08/28/2012 (5:32 am)
I vaguely recall seeing something about doing this by using two canvases of different sizes. It's been a while since I tried to do anything with a video, though I did have a thread a while ago asking how to skin an object with a one (which I didn't get very far with).
#20
08/28/2012 (5:47 am)
There is a source but the code file link is broken

www.garagegames.com/community/resources/view/15114/1#comment_form

Can anyone re-upload it please, this is one mother of resource.

I'm also looking for the ways of making the video transparent.

Apparently the way to make it transparent is to have 2 videos, one as your video you want to play and the other as black and white video where the black part should make your video be transparent e.g. cancel out the background of video 1.

I can provide 2 videos one of it with derived alpha (black and white).