Bitmapdata/bytearray to video file - actionscript-3

I just started working with Adobe Flash CS6, and have been trying to find a way to make a game that can record parts of itself. So far I have been able to capture the desired areas of the screen as bitmapData and encode that as PNG and JPEG to byte arrays, and have made an array that I use to store them in order of occurrence. I can use file reference to save them to my computer one at a time, but I need a way to group them together as a video file of any sort. Even as a GIF would do, it may not be video but at least it moves.
Basically I have a bunch of frames collected by my game, how do I get them to someone's desktop as a video file?
If this is impossible for Flash CS6, can it be done with Flash Builder or do I need Adobe Air? I have found multiple methods that work for Air, but I don't have it myself.

You are pretty much answering your own question: you have to encode the data in the right way. Intead of encoding as PNG or JPEG, encode into the video codes that you want.

Related

Can I use the effects made in Adobe After Effects in the game developed with Adobe Flash Pro and ActionScript 3? If so how?

I am developing a 2D game using Adobe Flash Pro CS 6 and ActionScript3. I am having some trouble in developing some effects e. g. bomb blast, particle effects etc. I want to know, whether I can use After Effects for those and then use them the game. Please suggest me.
There's no problem of using any graphics data from any program in Flash as long as flash can support the file format.
In case of After Effects graphics, you'll probably have to export them as a PNG file sequence, so they'll most probably be pretty large in file size.
To import:
You can either make a movie clip and just import the first image of a sequence with CRTL/CMD + R and Flash with be "smart" enough to suggest to load the other files of that sequence.
If you want, you can load them during run-time, add them to the array/vector, create a Bitmap object and change it's bitmapData property on enter frame/timer to animate it.
If you are decided on using the actual After Effects graphics rather than emulating them using an Actionscript 3 particle effect, I'd actually recommend exporting them as video on an alpha channel and then converting that to flv and then hosting them individually and streaming them in via Netstream and placing them on the proper layer via an addchild. If bandwidth isn't a huge concern here, this would be a good method for achieving this effect.
Here is some documentation on Netstream. http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d4e.html
If this seems like it might achieve the desired result, I can explain further if needed.

Optimizing Flash CC and swf

Good evening programmers.
Please do not laugh, but by flash file is 270 MB.
My artists have gave me their final art to me via illustrator.
What I have been doing is opening up the illustrator file and copy and pasting the objects in to flash.
I have movieclips, buttons, tweens and graphics in my library ( 556 items)
How can I optimize my Flash because the swf file is 30MB.
I also have 10 AS3 files, my code doesn't slow the file down, it must be the images.
Thank you.
I've deleted the un used files from my library and have saved the update flash file as another .FLa file.
Hasn't decreased the file that much, still the swf is quite slow when it comes to gameplay.
Sorry for panicking.
When you have complicated shapes and vectors flash takes its time to render the graphics, hence the pause between one frame to another.
To have solved this I had first broke apart the shape and optimized it.
But you see this didn't optimize it to an extent.
The files my artists supplied me with were 100mb - 200mb per file size.
So instead of importing it from Ill to Flash wich was naive I had exported the file to a PNG , which is more than a JPEG but has properties such as transparent background and quality.
What I have done is replaced all my imported images with the PNG version of that image.
Since the PNG is a flat image, it means that FLASH doesn't have to render as much.
Thank you for your comments.

Encode/Decode CMYK Images from Flash Player

I'm currently working on an image editor in Flash Player, and I need to be able to export CMYK images to my server. I'm completely new to color profiles and the like, and I was wondering how I could accomplish this. I am pretty sure all images in Flash Player are ARGB, so is there a way to convert the values properly?
You will need to read a little bit about the JPEG format - I mean, not just "JPEGs are used in XYZ, because XYZ." - I mean like the actual format down to the bytes. Because I don't really know if anybody did an actual library for that, maybe you will have to do it.
You need a library that understands the JPEG format and knows whether it is CMYK or RGB, and then to actually convert it (that includes the CMYK-RGB math).
It is not included in the flash built-in libs.

Is it possible to generate thumbnail from a flv using as3?

Is it possible to generate multiple thumbnails from a FLV using only as3? The flv is on the same server as the swf so I'm not using any dedicated streaming server. I'd imagine that as long as the flv has load the video you'd be able to pull bitmapdata from a specific time of the flv.
My idea is to pull around 8 images from every flv, convert them to buttons and use them as links to specific chapters in the flv.
If this is not possible, would it work better with a dedicated streaming server like red5?
Edit:
I'd also like to know how to do it if it's possible :)
The idea is to not use the server.
The thumbnails will only be used within the swif, so no saving to another location.
You can do this in AS3 as long as you're actually playing the video within Flash. While playing when you seek to the desired frame capture a bitmap. If you want to save the bitmap for later use you need server-side code to store it.
Streaming vs http download will not make this problem any easier or harder (although with a streaming server you can seek to the desired point without having to download the whole flv to that point).
This would be much better done on the server. You'll need an app that can extract an image from an FLV. ffmpeg can do it.
I know it is possible to get mplayer to output stills from an FLV (though might need a bit of fiddling to get the time reference right), and these in turn can be stuffed into ImageMagick to resize into thumbnails. Not best solution, but probably easier than digging around as3's API.
video thumbnailer is a good idea.
http://blog.chrometaphore.com/2010/03/26/how-to-create-video-thumbnails-runtime-in-pure-actionscript-3-0-videothumbnailer/

simple music or tunes via HTML?

I'm looking for a simple way to put up musical "tunes" on a website.
So here's an analogy to explain my question:
Let's say I want to put up a couple of big triangles as a picture on my web page. I can either draw a bitmap and save as GIF/JPG/PNG, put it up somewhere on the internet, and link to it with an element. That works but the larger the picture the more space my image file takes up.
Alternatively, I can use SVG (even though Internet Explorer support is lacking, grr) and use vector graphics which uses very little bandwidth regardless of image size.
In the music world, I can use WAV or MP3 files. Works great -- but if I just want to publish a 1-minute song of simple notes, by knowing the durations & pitches, & don't care that it sounds 100% exactly like a piano or accordion, is there a way to (a) create a file with the song, and (b) put it online in a format that is space-efficient? 1 minute of MP3 usually takes up hundreds of kilobytes.
You could use a MIDI file, this stores durations/pitches etc. as you suggest. You should be able to easily find software to create this type of file. However you will probably find the results sound terrible, as it is very dependent on the synthesiser hardware/software that is available on the end-user's machine.
For what you need this might be reasonable though.
Look into playing music files on websites using Flash.
You can control the Flash through JavaScript calls.
This is currently the "recommended" way to play small audio clips in a website.
For larger media files, look into streaming FLV files using a Flash player.
Hope this helps :)
Check out the MIDI format for instruments.
http://en.wikipedia.org/wiki/MIDI