Reputation: 1187
The following link describes how to build a flash project that captures a video stream from a webcam, encodes to h264 and stream it to a media server over a network connection:
http://www.adobe.com/devnet/adobe-media-server/articles/encoding-live-video-h264.html
My limited experience is that this approach is limited by available bandwidth, namely if the project is configured to record a video at a bitrate exceeding the available bandwidth, then frames are dropped and the final video is lacking.
I'm wondering if there are facilities in flash to either record to local storage or to an in-memory cache, and then upload it to the media server when the recording is complete? This let's a web app spend additional time uploading as the upload is decoupled from the recording, and there's no contention between video bitrate and bandwidth.
Upvotes: 0
Views: 1407
Reputation: 21
Actually there is a way. I've built a library encoding videos in web Flash (or AIR) by recompiling C/C++ code. It stores the video into memory as ByteArray and currently works with ogv(Theora/Vorbis codecs). It can also run in "realtime" mode which runs the encoding on another thread so it's capturing and encoding at the same time. You can try a free version anytime and see if it's useful or not...http://rainbowcreatures.com/product_flashywrappers.php. If the video being encoded is relatively short(dozens of seconds) and lower res(640x480, 800x600) the size is max. 5-15 MB.
I've been able to build demos with it to share the video to php, Facebook or store to disk.
Upvotes: 2
Reputation: 8149
Unless you are running an AIR app, no such functionality exists in Flash. With regards to local storage, all you have for a web-based application is the SharedObject
, which is generally limited to ~100kb, if I remember correctly. You'd be lucky to record a single frame of video in that space.
You can try to save directly to memory (i.e. just leave it as a ByteArray
), but depending on OS, browser, and plugin being used, your app is likely to be forced to shut down for overusing memory. Even if it didn't, this would be a poor choice since there could be a system with 512MB of RAM in it and you are trying to save a 300MB file in it. You would slow down that system (and even better systems) without even blinking an eye.
If you are using AIR, you can save the video to memory and then every few seconds, save that to disk using File
and FileStream
. The only limit there is the size of the drive it is being saved on. You could then upload at the end of the recording, or when the user is satisfied.
Upvotes: 1