Question

Im currently working on creating a web based game in flex. One of the features of the game is for it to be able to record the gameplay and have it on flv video file. This has been done thru capturing every frames of the game, having it on a bitmapdata object, then encoding it on a bytearray in a FLV format then saving it as a file.

Currently though, the generated flv video file is larger than usual, bout 4mb for 10sec video. This is because Ive only used Screen Video codec to encode the bitmapData into a FLV format. I want it to be smaller to save memory space as all recorded vids is intended to be in a webserver.

What Im trying to do now is to use h.264 encoding instead of screen video. To write bitmapdata as frames to H.264 encoding. After some research, I found about x264 library.

Now, I want to ask if it is possible to use x264 in a Flex project? If it is how will I use it? Do I need to migrate the x264 source into a action script before I can use its APIs? Or can I import the x264vfw.dll library directly in my flex project then use its APIs? If its not feasible at all to use x264 in flex what other options do i have?

Some examples on how x264 could be use in a flex project would be great. =)

Thanks.

Was it helpful?

Solution

The Flash player has all the pieces within it needed to allow this, but Adobe hasn't wrapped it up and exported an API for it. What you're asking for is basically a Camera object that refers to the stage/screen rather than to a webcam. You should ask Adobe for this.

Flex doesn't help you because it can't do anything you can't do from ActionScript. Flex is just a very helpful wrapper over the original Flash development APIs, plus some support tooling. At bottom, it's all just ActionScript 3 code.

You can do what you ask with AIR 2.0 and up, via the new NativeProcess class. This would let you bundle the x264 binary with your AIR app, and call out to it to do the compression. You'd need to provide a separate x264 native binary for each platform you wanted to support, of course. Repackaging a Flex app as an AIR app is pretty easy, but your game would no longer be a web game, it's be more like a native game that just happened to be written in Flash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top