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

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/

Related

Bitmapdata/bytearray to video file

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.

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.

Webcam fire Flash effect

Is there any source code available in ActionScript3 that does something like this: http://gskinner.com/blog/archives/2005/11/flash_8_webcam_1.html
http://blog.soulwire.co.uk/code/actionscript-3/webcam-motion-detection-tracking
The link above isn't exactly what you're looking for but similar. You could probably grab the original processing.org IDE which comes with samples, one is a webcam background differencing program, you can probably copy the algorithm from there if you're having trouble coming up with something yourself. Using flash BitmapData methods and tweaking blendModes with a couple of frames can get some interesting stuff going.

How to handle resources for as3 web game? (Embed/Loader)

Ask a question .. images resources of the flash game , How should I load? I use the Loader class, but some people use the embedded resources.Can you tell me in which case use "Loader" class and in which case use "[Embed]"?
It all depends on the game requirements. You have to have in mind that if you use Loaders your game will not work in offline mode (without internet access), which in some cases is critical (i.e. a flash game for a mobile device).
If the final file size isn't a problem, then you should always embed your assets and load only dynamic resources (i.e. ads). You can always use assets libraries to store the resources and to reduce the initial loading time for the application.
Using the embed tag literally compiles that resource into the final SWF output. So it's a matter of how much preloading you want to do and how big you want your initial swf to be. If you are embedding some small thumbnail images or sound files, this may be okay to an extent. But if you embed all of your assets or large assets, well you can figure it out from there, you're going to merge that file size + the size of any other files into 1 file, which is also meant to be your user interface. Keep assets external (for the most part) and dynamically load them in. There might be specific cases as mentioned here in other answers where it is required but unless otherwise dictated, organize your assets and simply load/unload them as needed. The other nice thing about using the Loader class is that is gives you more control over destroying the object from memory than anything else. You can call the unloadAndStop(Boolean CallGarbageCollector) method and directly request the VM to forcefully stop, delete and clean that object up. Anyway hope this clarifies things.
If you would submit your game to Kongregate or Newgrounds, they have strict rules - game should consist of one file. If you host game yourself, you may do as you wish, but take into account that loading needs time and your game find that some resource needed and not yet loaded.
As a rule of thumb, if your game is small, embed everything. If resources are vast and not used simultaneously, think about loading dynamically - this is much harder but allows for faster game start.

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