Hi,
Well, the simplest way to "capture" a frame of video into a bitmap that
I've come up with is like this ...
1. Create an empty movie clip that will hold the bitmap later:
import flash.display.BitmapData;
var myBitmap;
this.createEmptyMovieClip("holder_mc", this.getNextHighestDepth());
holder_mc._x = 20;
holder_mc._y = 20;
2. When you've got your video loaded (say into "videoContainer") then you
can setup the dimensions for your bitmap and attach it to the holder:
myBitmap = new BitmapData(vidWidth, vidHeight, true, 0x00FFFFFF);
holder_mc.attachBitmap(myBitmap, 1);
3. Now, whenever you want to make a copy of whatever is presently being
shown in the "videoContainer" to appear in your bitmap holder, do this:
myBitmap.draw(videoContainer);
4. That's that. You have a pretty snapshot (probably scaled down).
Beyond that - getting whatever is stored in "myBitmap" sent somewhere to
be saved or retrieved for later is where I gave up a year or two ago
(aside from sending it pixel by pixel and using GD to recreate it as a
JPEG that can then be saved on the server for later).
I always thought it should be possible to send it as an object and maybe
store it in a database, however I think the ultimate issue had something
to do with the fact that the Flash player can't deserialize it back into a
BitmapData object when reading the object back from the local shared
object.
One other thought that came to my mind was the relative ease with which
you can use the ns.seek(seconds); command to position the video head at
any arbitrary point - then take a shapshot of that, display it in one of
your holders, and move on to the next one. If you had a list of time
points in your file, then you could probably just generate these snapshots
on the fly each time you needed them - say to build a scene selection for
your video. Rather than saving the images, just remember the times, and
recreate the images ...
Anywho - Google around "Save Bitmap object Flash" may be a good start.
Let me know if you come across anything that might work better. =)
Nathan
On Tue, 24 Apr 2007, Claudius Ceteras wrote:
> > And I'm sure that there are many of us who could spend an hour or two
> > figuring it out - I have done it in the past, although the method was
> > really messy and slow.
>
> Figuring out the details isn't really the problem if i just get a hint what
> to do.
>
> Do i really need to iterate over all pixels and send them manually to the
> server? This would be really bad, because 640*480*24bit = 900kB for one pic!
> And I can't use any compression here, right?
>
> Isn't there a better way? Like maybe it is possible to choose the exact
> frame to send to the server by publishing just for 1/30th of a second when
> setting fps to 30. And maybe i can implement an interface on the serverside
> to intercept this very frame and save it to a JPG.
> Can anyone with enough insight in the inner workings of red5 shed some light
> on whether something along these lines would be possible?
>
>
> regards
>
> Claudius
>
>
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org