avi reader

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

avi reader

Post by rt »

good news, i was able to implement an AviReader class that works with Irrlicht! (windows only) check out the screenshot

Image

i loaded up "Operation Condor" which happens to be a great jackie chan flick in case you haven't seen it :P the avi was 690 MB, 24-bit video with divx compression. the AviReader streams in the data from file.

the avi frames are loaded into an ITexture which can then be scaled or tinted or whatever (i alpha blended the movie in that screenshot just for effect) before you blt it to screen. once i clean up the code i'll post it.
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

cool, are you going to post the source?

--The Robomaniac
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Wow, very impressive! Are you planning to make a demo or source available?
DarkWhoppy
Posts: 386
Joined: Thu Sep 25, 2003 12:43 pm
Contact:

Post by DarkWhoppy »

Thats a huge AVI 690Mbs :shock: But awsome :D , maybe next we can add some MPEG-1 support. 8)
Programmer of the Irrlicht Scene Editor:
Homepage - Forum Thread
Version 2 on its way!!
PhilK
Posts: 5
Joined: Mon Dec 15, 2003 1:00 pm

Post by PhilK »

I wonder how many frames you get in your application. I am streaming live video from my webcam onto a texture and its a big speed hit. I create a texture and whenever a new frame arrives from the webcam I lock the texture and copy 32bit pixel data from video image onto the texture.
I map the texture onto a 1x1 plane and insert the plane into the scenegraph.

hmm... pretty straight forward.

Cheers,
Phil
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

PhilK wrote:I wonder how many frames you get in your application
at 800x600 in directx mode i get 400 fps without the movie playing, and 230 fps with the movie playing. once i optimize the code i expect that number to climb

[edit] after some tweaking the fps drops from 400 to 330
Last edited by rt on Wed Jan 07, 2004 6:11 am, edited 1 time in total.
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

niko wrote:Wow, very impressive! Are you planning to make a demo or source available?
i plan to make a posting in the tutorial forum when the code is ready. i'm re-coding the variables using the irrlicht datatypes.
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

DarkWhoppy wrote:Thats a huge AVI 690Mbs :shock: But awsome :D , maybe next we can add some MPEG-1 support. 8)
you can convert mpeg to avi using any video editing software like http://www.virtualdub.org/
DarkWhoppy
Posts: 386
Joined: Thu Sep 25, 2003 12:43 pm
Contact:

Post by DarkWhoppy »

What i mean is.. say you want to have a ... 20 second video. Thats going to be a big file using AVI format. But with MPEG it'll be compact.
Programmer of the Irrlicht Scene Editor:
Homepage - Forum Thread
Version 2 on its way!!
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

DarkWhoppy wrote:What i mean is.. say you want to have a ... 20 second video. Thats going to be a big file using AVI format. But with MPEG it'll be compact.
avi is a container format, which means it can contain video and audio compressed using many different combinations of codecs.. if you generate an avi using divx then it would be as small or smaller than the same movie in mpeg-1
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

wow...all i can say is wow....

Post by buhatkj »

thats....so...AWESOME!!!
i want i want i want!!!

hehe no seriously thats a really spiffy mod dude, i look forward to giving it a shot once you release it :-) i could definitely use that in Fmorg, i could make neat stuff like TV's or monitor screens with actual video playing on them in-game!! wheee!!!

~Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

buhat, you have to be very careful with video in game.

1) it causes a slight FPS drop, as its constantly loading and writing to a texture before you can draw each frame.
2) adding videos to your game will make your distribution bloat up fast.
3) loading in a video to display can cause a temporary pause in your game (unless you're using a non-blocking thread to load resources like this in for you, and your code is smart enough to draw an imposter while you're doing so-- if you dont know what I just said, then forget about it).

You should consider using videos sparingly, such as at the Splash Screen, End Screen and perhaps Level Transitions. Videos which are in-game should be very low resolution, and very short in length so that they can be loaded and unloaded quickly. (Otherwise you'll have to load in a giant video at the beginning of a level, and keep it in memory until that level is unloaded, even if they arent in the same room and cant see the quad where the video is being played).
a screen cap is worth 0x100000 DWORDS
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

keless wrote:buhat, you have to be very careful with video in game.

1) it causes a slight FPS drop, as its constantly loading and writing to a texture before you can draw each frame.
2) adding videos to your game will make your distribution bloat up fast.
3) loading in a video to display can cause a temporary pause in your game (unless you're using a non-blocking thread to load resources like this in for you, and your code is smart enough to draw an imposter while you're doing so-- if you dont know what I just said, then forget about it).

You should consider using videos sparingly, such as at the Splash Screen, End Screen and perhaps Level Transitions. Videos which are in-game should be very low resolution, and very short in length so that they can be loaded and unloaded quickly. (Otherwise you'll have to load in a giant video at the beginning of a level, and keep it in memory until that level is unloaded, even if they arent in the same room and cant see the quad where the video is being played).
i'm using the AviReader class in two projects. In the first one there is no noticble drop in the fps (~100) when a movie is playing. In the second project which uses irrlicht the fps goes from 400 to 330 which is not too shabby :) you can increase the fps by forcing the avi to play less often (for example, force the avi to play at 40 fps instead of the 100 fps i default it at)

the AviReader also streams in the videos so there is not a big memory requirement either.

there is a very slight pause when the avi is first loaded, but this can be done at the beginning of a level when it is not noticible. all in all i was very suprised at how quickly the avi can play. in fact, in my other project i'm planning to have a movie as part of the 2d landscape!
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Re: wow...all i can say is wow....

Post by rt »

buhatkj wrote:thats....so...AWESOME!!!
i want i want i want!!!
hehe no seriously thats a really spiffy mod dude, i look forward to giving it a shot once you release it :-) i could definitely use that in Fmorg, i could make neat stuff like TV's or monitor screens with actual video playing on them in-game!! wheee!!!
~Ted
i've already posted the code in the 'tutorial' forum. check out this thread http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=927 .. you can be the first to reply! :lol:
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

not like i'm gonna play LOTR on it...

Post by buhatkj »

well when i say i would use it on in-game objects, im saying like a 5-secord looping clip for a monitor screen, and yeh im sure there would be a framerate hit, but with my frame limiter off, i get 80FPS, and my limiter chops it to 30(on purpose, i wanna save some CPU time for other things...), i would think i could still make the 30 FPS, and i can prolly build it so it only bothers to apply the texture if its in the viewing frustrum, so if i have 50 screens in different parts of the map, only one or two is on at once...

of course, the best use for this feature, like you say keless, is for cut-scenes, so we can flip to an FMV cutscene without dropping out of the engine.

i can also see where i might want to use the alpha to blend a video slowly in for a nice movie style dissolve transition...

its one of those features that give me lots of fun ideas, but trust me, i AM considering performance when i add these sorts of things, at the same time, i want FMORG to be as immersive as i can make it....

oh, and as to your idea keless of using a thread to load stuff, i did think about it, but instead of taking the BIG FR hit i noticed when i was trying to use threads for part of the MD3 anims, ive been loading em up at program startup and setting 'em invisible till i need 'em. I know its a mem hog, but personally i have more RAM than CPU. I'm not sure at this point which way I'll do it in the end....suggestions??

peace out,
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Post Reply