*blog... kind of... *rss
FLV to BitmapData Sequence
1 commentSo, 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.
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.
*profile

traditional id: Ricardo Cabello Miguel
based in: London, UK
more: github, twitter, twitpic, soundcloud and flattr
*post nav
PC stands for Personal Computer
Monster Burnout
Flash Media Server 3 example
"The nail that sticks out gets hammered down"
Java fullscreen! evil?
FLV to BitmapData Sequence
Adobe, MAKE SOME NOISE
Er... yes?
interview @ ex7
SilverLOL 2.0
So, is the demoscene really dying?
It was a very usefull class, my video navigation performance is much better now! I've slightly changed the class so i could use it with movieclips imported in a swc file.
I had to extend to MovieClip intstead of a Sprite, then there were some extending naming issues. But that was easily corrected.
tnx!