How to make dynamically generated Flash movie available for download?
Users provide various elements of content for the final Flash movie, eg. text and photos. We want to be able to allow the user to download the movie they create in a f开发者_如何学Pythonormat such as MP4 which they can play on their local computer or upload to YouTube.
Any ideas on how to do this?
Your one and only option that I am aware of (and I'm reasonably aware of what is possible within this field) is using library like this: https://github.com/zeropointnine/leelib/tree/master/src
This library allows you to create an FLV file by code. Maybe creating an AVI file from code is also possible, but that requires quite a deep level of understanding on this format. Downside of the above mentioned library is that your files will get quite large.
http://www.zeropointnine.com/blog/simpleflvwriteras-as3-class-to-create-flvs/
I'm pretty sure this is the same link as what PaulT has given.
Using the flvwriter class, I was able to generate an flv without sound. What the writer class does is grab bitmapdata from the source displayobject, writes each bitmap as a frame into an flv, and then writes the designated FPS to the flv file for playback.
The thing is, pure bitmap data is not a valid codec on youtube and most media players. And also, the writer class is for AIR I believe.
And on top of this, generating a video in this manner can be very intense, you will definitely notice choppiness (but the flv generated should still be smooth).
So my solution was to store the customized options the client made, send them to your server, run the air file with flv writer that takes all that data and plays it, and then use ffmpeg to convert the flv into something feasible. ffmpeg can also combine the audio to your mp4...just not sure how to capture the audio easily if it's a bunch of sounds.
By the way, this can all be done within air, you can call ffmpeg.exe via the native process api. I had problems with ffmpeg crashing on me though...
精彩评论