*blog... kind of... *rss
FLV to BitmapData Sequence 17.03.2008 | |
So, here I am, still finishing off a project I've been doing at Hi-ReS! for almost 4 months already. Doesn't matter how many time I look at it, I can't see where I spent all that time. I guess it has been all on research, file optimisations, fighting with Papervision3D 2.0... By the way... Andy and Tim, thanks a lot for the constant help! <3!
I could explain some tricks I've learn on this project, but I'll leave it for some other post... I'm already out of focus... The snippet of the day:
FLV to BitmapData Sequence
On the project there were some textures that were FLV animations. At first I had it as a bitmap sequence on the library and it was running quite well, but obviosly, that would be intraframe compression, which means BIG. So, .FLV needed to be used instead. And as it was interframe compression the filesize was much more smaller. But the problem then was that it was making the whole app almost 10fps slower. The decoding of the FLV plus (bad) looping was being very CPU expensive.
So, somehow I had to find a way to mix both best features, small filesize and low CPU usage, the easy answer was just, somehow, creating a bitmap array with each frame in the video (the video doesn't have sound btw). Tried it using the Video methods (seek() and stuff) but there was no way I could jump frame by frame. I guess using these methods you can only jump to the next keyframe. As having a keyframe per frame was going back again to the intraframe compression it was time to google a bit.
Unfortunately (and also fortunately) the only bit I found was this Seb's post, which thanks to Tink managed to find a decent approach for the issue.
Just as Tink suggested, create a .SWF with the .FLV embeded (which, somehow, stays at the same filesize). Having that you get the MovieClip's magic methods: gotoAndStop(), nextframe()...
So, the only thing you need is the small class I put together today:
BitmapDataSequence.as
It's the first version, so don't expect more than the basic stuff. Oh, and yes, it runs MUCH faster than the .FLV and it loops nicely oh, and you could easily change the FPS too. | | posted by mr.doob at 17:32 | | 0 comment written so far |
SORRY! Is not that I don't care about what you have to say, of course I do, but they are speaking louder and I lost my patience :(
|
|
*profile

traditional id: Ricardo Cabello Miguel
based in: London, UK
serving to: Hi-ReS!
contact me: click here
*latest posts
* Showcase is back, now in Javascript (19.11.2008) * Zeh's Fnk (15.11.2008) * Lupen III (Italian Opening) VS Captain... (08.11.2008) * Duuuuude! (31.10.2008) * Pump 'N Seal, Jackie Chan, Manuela and... (26.10.2008) * Ubuntu 8.10 on a Macbook Pro (25.10.2008) * Ubuntu 8.04, Apple Keyboard - Change F... (22.10.2008) * Rules for making the internet a better... (21.10.2008) * The Magic of Viral (10.10.2008) * Jonathan Harris: Beyond Flash, an adde... (06.10.2008) * Zeitgeist: Addendum (05.10.2008) * Crisis (03.10.2008) * Youtube, now in Super HD! (30.09.2008) * Adobe AIR for Linux - Beta (28.09.2008) * What does the Google Chrome logo inspi... (28.09.2008)
*latest comments
* C++, SDL Coding? Maybe.. ;) (Preview) (trace) * C++, SDL Coding? Maybe.. ;) (Preview) (Joey) * La picaresca (spt) * Mr. Slip Up (ricardo) * La picaresca (ricardo) * La picaresca (spt) * La picaresca (sole) * Demoscene @ Cirsa (sml) * La picaresca (humphr3y) * La picaresca (alfio) * fiver2's new baby: debris (Jcl) * Barcelona = full of shit(s) (Soli) * Demoscene @ Cirsa (Scener) * Rar & unrar with Ubuntu (SethPlate) * Mindcandy 2 (Jcl)
*wish list
|