Here is something i was thinking for along time : capturing a flash movie area and save it to video file.
Hopefully I found a great AIR example to do this on : http://www.zeropointnine.com/blog/simpleflvwriteras-as3-class-to-create-flvs/
This application saved bitmapdatas to FLV video file.
I turned it into non-AIR application, and i took the opportunity to add several improvements:
- easier constructor creation (simply specify displayobject to capture and video fps)
- memory optimization
- faster video computation
- internal capture management
- capture area parameter
In the example captured area is inside a movieClip, and captured FLV is saved to local disk.
// capture screen_mc clip , with 20fps framerate // note that clip bounding box will be used as capturing area var _myRecord : FLVRecord = new FLVRecord(screen_mc, 20); // start recording (or resume capture) _myRecord.start(); // stop recording (or pause capture) _myRecord.stop(); // you can use clean() to start a new record with start(); _myRecord.clean(); // and finally get the FLV raw data of FLV to save it or send it to PHP script var _file : FileReference = new FileReference(); _file.save(_myRecord.flvRawData, "video.flv");
And here is source download link.
BE CAREFUL WITH MEMORY !!!!!
FLV files are quite huge, so use it wisely !!!
To reduce FLV file size, lower FPS parameter and restrict capture area :
// capture screen_mc clip , with 15fps framerate, and restricted capturing area var area : Rectangle = new Rectangle(92,9, 160,224); var _myRecord : FLVRecord = new FLVRecord(screen_mc, 10, area); // survey FLV size if it's going to big var flvSize : Number = int(_myRecord.flvLength/100000)/10; // size in megabytes if (flvSize>35) trace("FLV size is larger than 35Mo);