如何在 Adobe Air/Flash 中对视频进行编码?
我有一个 Adobe Air Flash、Action script 3.0 应用程序。我需要将网络摄像头(或者更确切地说,一系列位图作为帧)保存到视频文件中。视频文件需要压缩并且需要按帧保存。
I have an Adobe Air Flash, Action script 3.0 application. I need to save the webcam (or rather a series of bitmap as frames) to a video file. The video file needs to be compressed and needs to save as the frames go.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AIR/Flash 不允许您访问任何本地视频编码器,因此压缩视频是此问题的难点。
其余的,使用 BitmapData.draw() 函数抓取视频帧。然后您可以将文本绘制到相同的位图数据中。
对于未压缩的视频,您可以执行以下操作: http://www.joristimmerman.be/wordpress/2008/12/18/flvrecorder-record-to-flv-using-air/。
理论上,您可以用 ActionScript 编写视频编码器。没有人这样做的事实告诉我,您会遇到问题(对于某些编解码器来说,无论是技术问题还是法律问题)。在 AIR 中,更好的做法是使用 NativeProcess API 或本机扩展将编码卸载到本机代码。这需要将 AIR 应用程序本身作为本机应用程序发布,并为您支持的每个平台创建单独的版本。 (通过添加对本机代码的依赖项,您将失去 AIR 的跨平台优势。)
在 Flash(在 Web 上)中,执行此操作的典型方法是将相机流发送到服务器并在那里进行处理。
AIR/Flash don't give you access to any local video encoders, so compressing the video is the hard part of this problem.
For the rest, grab video frames using the BitmapData.draw() function. You can then draw the text into the same bitmapdata.
For uncompressed video, you can do something like this: http://www.joristimmerman.be/wordpress/2008/12/18/flvrecorder-record-to-flv-using-air/.
Theoretically, you can write a video encoder in ActionScript. The fact that nobody has done so tells me that you would run into problems (either technicaql or legal -- for some codecs). In AIR a better course of action would be to use the NativeProcess API or a native extension to offload the encoding to native code. This requires releasing the AIR app itself as a native app and creating a separate version for each platform you support. (By adding dependencies on native code, you lose the cross-platform benefits of AIR.)
In Flash (on the Web), the typical way to do this is to send the camera stream to a server and do your processing there.