如何录制视频到本地磁盘中的空气? [英] How do I record video to a local disk in AIR?

查看:184
本文介绍了如何录制视频到本地磁盘中的空气?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想录制的摄像头的视频和音频存储在用户本地硬盘上的FLV文件。我有一个版本,它使用NetConnection和NetStream流通过网络向FMS(Red5的)服务器的视频,这就code的工作,但我希望能够在本地存储视频的低带宽/片状网络的情况。我使用Flex 3.2和AIR 1.5,所以我不认为应该有任何沙盒限制其prevent这种情况的发生。

I'm trying to record a webcam's video and audio to a FLV file stored on the users local hard disk. I have a version of this code working which uses NetConnection and NetStream to stream the video over a network to a FMS (Red5) server, but I'd like to be able to store the video locally for low bandwidth/flaky network situations. I'm using FLex 3.2 and AIR 1.5, so I don't believe there should be any sandbox restrictions which prevent this from occurring.

东西:

  • 的FileStream - 允许reading.writing本地文件,但没有。的attachCamera和.attachAudio methids创建FLV。
  • flvrecorder - 产生屏幕抓取从网络摄像头,并创建它自己的FLV文件。不支持音频。授权禁止商业用途。
  • <一个href="http://www.zeropointnine.com/blog/simpleflvwriteras-as3-class-to-create-flvs/">SimpleFLVWriter.as - 不奇怪许可证flvrecorder类似。不支持音频。
  • 这个计算器帖子 - 这表明回放从本地磁盘使用一个NetConnection视频/ NetStream的。
  • FileStream - Allows reading.writing local files but no .attachCamera and .attachAudio methids for creating a FLV.
  • flvrecorder - Produces screen grabs from the web cam and creates it's own flv file. Doesn't support Audio. License prohibits commercial use.
  • SimpleFLVWriter.as - Similar to flvrecorder without the wierd license. Doesn't support audio.
  • This stackoverflow post - Which demonstrates the playback of a video from local disk using a NetConnection/NetStream.

由于我有使用NetStream流来我认为最后是最有前途的和说干就干,放在一起这个演示应用程序的服务器的一个版本了。在code编译和运行没有错误,但我没有点击它停止按钮磁盘上的FLV文件。   -          

Given that I have a version already which uses NetStream to stream to the server I thought the last was most promising and went ahead and put together this demo application. The code compiles and runs without errors, but I don't have a FLV file on disk which the stop button is clicked. -

<mx:Script>
    <![CDATA[

        private var _diskStream:NetStream;
        private var _diskConn:NetConnection;
        private var _camera:Camera;
        private var _mic:Microphone; 

        public function cmdStart_Click():void {
            _camera = Camera.getCamera();
            _camera.setQuality(144000, 85);
            _camera.setMode(320, 240, 15);
            _camera.setKeyFrameInterval(60);

            _mic = Microphone.getMicrophone();

            videoDisplay.attachCamera(_camera);

            _diskConn = new NetConnection();
            _diskConn.connect(null);

            _diskStream = new NetStream(_diskConn);
            _diskStream.client = this;
            _diskStream.attachCamera(_camera);
            _diskStream.attachAudio(_mic);
            _diskStream.publish("file://c:/test.flv", "record");

        }

        public function cmdStop_Click() {
            _diskStream.close();
            videoDisplay.close();
        }

    ]]>
</mx:Script>    
    <mx:VideoDisplay x="10" y="10" width="320" height="240" id="videoDisplay" />
    <mx:Button x="10" y="258" label="Start" click="cmdStart_Click()" id="cmdStart"/>
    <mx:Button x="73" y="258" label="Stop" id="cmdStop" click="cmdStop_Click()"/>

</mx:WindowedApplication>

在我看来,这有任何不对劲上述code这是$ P $从工作pventing它,或NetStream只是不能在此温妮被滥用来录制视频。

It seems to me that there's either something wrong with the above code which is preventing it from working, or NetStream just can't be abused in this wany to record video.

我想知道的是,一个)什么(如果有的话)是错误的code以上? b)若NetStream的不支持记录到磁盘,还有没有其他的替代品,捕获音频和视频的用户文件本地硬盘?

What I'd like to know is, a) What (if anything) is wrong with the code above? b) If NetStream doesn't support recording to disk, are there any other alternatives which capture Audio AND Video to a file on the users local hard disk?

在此先感谢!

推荐答案

这是不可能的视频流直接传输到本地磁盘上,而无需使用一些流媒体服务,如Windows媒体连接codeR,或Red5的或者Adobe公司的媒体服务器或别的东西。

It is not possible To stream video directly to the local disk without using some streaming service like Windows Media encoder, or Red5 or Adobe's media server or something else.

我曾尝试在互联网上所有的样品没有解决方案是最新的。

I have tried all the samples on the internet with no solution to date.

看一下这个链接,另外一种可能性:

look at this link for another possibility:

http://www.zeropointnine.com/blog /最新-FLV-CN codeR-ALCHEM /

这篇关于如何录制视频到本地磁盘中的空气?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆