AVI as a texture

Blitz3D Forums/Blitz3D Programming/AVI as a texture

Naughty Alien(Posted 2005) [#1]
..Is it possible to use AVI or any other format like that as a texture within Blitz3D, and if it is, how?


Bouncer(Posted 2005) [#2]
Yes it's possible... there was an example someone posted a long time ago in these forums... don't remember who or what was it called though...

You propably just need to render the avi normally then copyrect to texture.


John Blackledge(Posted 2005) [#3]
Oh dear. Yes it is.

But be warned, there is a bug in OpenMovie() which causes a reduction of available video memory each time you loop the video.

Unfortunately CloseMovie() does not free the movie memory, so when you re-open (to effect a loop), a new version is loaded into memory. (Still hoping for a reply from Blitz Support on this one.)

If you don't need to loop there's no problem.


Ross C(Posted 2005) [#4]
As bouncer says, just simply drawmovie to advance to the next frame, copyrect into a texture.


Naughty Alien(Posted 2005) [#5]
well..I have to keep AVI in loop, and I realized too that memory is not released after CloseMovie...hmm...this suckss..


Ross C(Posted 2005) [#6]
You don't need to loop the AVI. Just copy all the frames to a texture and your sorted.


Paolo(Posted 2005) [#7]
That problem is not so true,
I'm using some AVI as textures in my game
and I did some tests a while ago, although
your video memory decrease each time you open
the movie, I found that if your memory goes to less than
cero, then all the memory is restored correctly...

I'm testing with a 32mb video card, and for example
when I have a level that consumes 15mb, when you start
to open movies you see the memory left decreasing each
time, but if it goes under than cero it jumps again to
15mb as free memory ....
... try doing the same to see if it also works this way for you ...


John Blackledge(Posted 2005) [#8]
It would be really good if what you say is true, but two thoughts:
a) Why would that happen? Blitz? Windows? It sounds bizarre.
b) What would the 'action' of a complex game be like with ever decreasing memory?

We really need a reply from Blitz Research on this on.


jfk EO-11110(Posted 2005) [#9]
I made a test some time ago and it seemed the memory is restored virtually, officially, although it failed to use the newly created textures (created after the movie memory hole consumed about 100% of all resources) and the framerate dropped to 1 fps or something. I think that was virtual Vram, taken from the system ram.

I also hope Blitz's Move capabilities will be improved. Because using 3D hardware to process some Video FX etc. is very nice. This requires a few more Movie Commands and the Bugfix that was mentioned. Well maybe it's a directshow thing.

BTW Alien - you should use the built in animated Textures instead.


Naughty Alien(Posted 2005) [#10]
JFK, Thats good suggestion, but Animated textures is not good option since I have to run about 1 minute long AVI( request from customer, aand AVI will be applied on to TV screen surface..interactive walktrough project,I'll post it here when I finish), so it means about 1500 frames (if movie FPS is 25)..my concern is size of bitmap prepared for animation sequence...


John Blackledge(Posted 2005) [#11]
JFK, it feels to me as if the memory restoration is a Windows function. That's the sort of thing MS do if an app looks as if it's threatening the system.
Don't like the idea of a drop down to 1 fps though.

Naughty Alien's situation of a projected video as a TV screen for a client is exactly the sort I had in mind - it would be a shame to say 'No, that can't be done' regarding video, when in fact I've never had to say that before about Blitz generated apps.


jfk EO-11110(Posted 2005) [#12]
Some time ago there was a BBPEG source in the archive, now it's gone. It was capable of playing mpeg1 movies without to use blitzs Movie Commands.

Personaly I use MCI Sendstring to do all kinds of movie stuff (see Dr. Green), but it's such a bugous thing. Most important: you will only be able to capture the MCI-players frames in fullscreen mode, not in windowed! If you can live with that limitation, you may give it a try.
http://www.blitzbasic.com/codearcs/codearcs.php?code=1329

Well I'm not sure if you can play it to the backbuffer without to mess up the main render work (telling MCI to play the movie will make it draw frames whenever IT likes to do so, eg. in the middle of your other drawing or rendering processes. But it may be possible when you use Pause etc.)


Naughty Alien(Posted 2005) [#13]
..thanks JFK....walktrough should be only fullscreen mode, so it will be ok...I'll give it a try to see how its works...I hope it will be no problem with assigning AVI played on this way on to TV screen surface...


John Blackledge(Posted 2005) [#14]
Alien - let us know.
I think what jfk is saying is that MCI will render wherever it wants, usually the main window. The few experiments I've done with MCI give the impression that MCI only acknowledges the main window, and has no concept of a 'buffer' - it is after all a 15 year old system, good in its day, but written for Windows 3.11.

If anyone can find BBPEG please let me know.
I've searched this site and google - no luck, and no info about FoX the author.


Naughty Alien(Posted 2005) [#15]
..yup..BBPEG would be great to have..I'll look forward to it too..


mongia2(Posted 2005) [#16]
link for code archives

http://www.blitzbasic.com/codearcs/codearcs.php?cat=11

mongia2


John Blackledge(Posted 2005) [#17]
@mongia2 - Sorry, what's your point?
This is the way that we're all doing it already.
Our point is that there's a memory leak when the video opens/loops.


jfk EO-11110(Posted 2005) [#18]
well there have also been a few DLLs written for Blitz, eg. BlitzMovie. THe orignial Download is broken, so I host it:
www.melog.ch/dl/blitzmovie1.3-beta.zip

BTW John you're right, I just tried to make MCI draw to the backbuffer, without success. I draws to the frontbuffer no matter what and even ingores Flip.


mongia2(Posted 2005) [#19]
blitzmovie is not stable!!

mongia2


John Blackledge(Posted 2005) [#20]
Sob, sob.
I feel we're really in a fix here.
I really wanted to use TV screen and billboard effects.
And all for the sake of a FreeMovie() memory-clear type call!


jfk EO-11110(Posted 2005) [#21]
Yes, a bugfix is needed. Tho I am still using Version 1.89 and I hope versions higher than 1.90 won't mess up my source codes. I'd risk it, especially when Mark would add a SeekFrame/Pause Function.

Or: someone has got to write a new player, probably by using some existing code, eg. from sourceforge. Something that will draw frames to a bank. Using the dirty bank adress hack would allow this.