jan 05

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.

Usage :

// 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);

Enjoy.

nov 30

Here is a little experiment with the Google TTS (Text To speech) API.

As far as i looked, there no limitation for using this API, so enjoy :

NB : as a bonus, here is a funny use of TTS in german language :)

Here is a short code to use my TextToSpeech class :

var _txt2Speech : TextToSpeech = new TextToSpeech();

// and simply call a new text to be said
// passing text + language to be used
_txt2Speech.say("bla bla bla", "en");

And here is source download link.

Have fun !

NB : for unknown reasons, the example is not working under Chrome browser...

nov 26

Here is a little experiment around the exciting Open Kinect project :
http://openkinect.org/wiki/Main_Page

My idea was to use the as3-server that comes with the git archive.

Here are the several steps I've been through to get to this raw result :
- compilation of the as3-server on OSX (yesterday version was finally working)
- turned AS3 singletons examples to exploitable classes (to instantiate sockets individually and the get 3 streams at the same time)
- found that Flash has to get the policy file from server before init the next sockets (i created a queue for sockets)

And here is the result :

Upper image results from the RGB stream.
Bottom image is the Depth stream.
Extra data are shown in the white box.

I hope to have time soon and go deeper in all these data streams and create something fun.