简体   繁体   English

使用开源媒体服务器捕获Flash网络摄像头/麦克风

[英]Flash webcam/microphone capture with open-source media server

A media server is required for capturing video from Flash but none of them seem to have any documentation available (not even API docs or other source code comments). 从Flash捕获视频需要一个媒体服务器,但它们似乎都没有任何可用的文档(甚至没有API文档或其他源代码注释)。 I would prefer crtmpserver because my application is written in C++ and it needs to receive and process the captured data in real time. 我更喜欢crtmpserver,因为我的应用程序是用C ++编写的,它需要实时接收和处理捕获的数据。 However, Red5 is clearly a lot more mature and better known project so I do consider that an option too. 但是,Red5显然是一个更成熟,更知名的项目,所以我也考虑了这个选项。 Adobe FMS is too expensive and might be difficult to integrate with my application as Adobe never mentions such use case. Adobe FMS太昂贵,可能很难与我的应用程序集成,因为Adobe从未提及过这样的用例。

As far as I can tell, one has to write an "application" for the media server (they don't ship with anything usable) and that will then have to forward the data for actual processing. 据我所知,必须为媒体服务器编写一个“应用程序”(它们没有附带任何可用的东西),然后必须转发数据以进行实际处理。 What sort of data can an application expect from the media server, is it going to be a plain FLV stream or is there something more to it (bandwidth negotiations etc)? 应用程序可以从媒体服务器获得什么样的数据,它是一个普通的FLV流还是还有更多的东西(带宽协商等)?

Coding the Flash side is not an issue, there are plenty of examples for that (even if they don't tell how the media server URL should be constructed). 编写Flash方面不是问题,有很多例子(即使他们没有说明应该如何构建媒体服务器URL)。

The actual question: how does the server side work (high level view) and is there anything to get one started with the live capture functionality? 实际问题:服务器端如何工作(高级视图),是否有任何东西可以从实时捕获功能开始?

A couple years back I was working on an e-learning project that allowed the students to record an answer (audio only in my case) and the professor could listen to it and grade the student. 几年前,我正在开展一个电子学习项目,允许学生记录答案(仅在我的情况下是音频),教授可以听取它并给学生评分。

We considered Adobe FMS, Wowza Media Server ( http://www.wowzamedia.com ) and Red5. 我们考虑过Adobe FMS,Wowza Media Server( http://www.wowzamedia.com )和Red5。 In the end Red5 was chosen because it was the only free open source options which was stable enough to be used in this project, even though it lacked much documentation. 最后选择Red5是因为它是唯一一个足够稳定的免费开源选项,可以在这个项目中使用,即使它缺少很多文档。

How it worked was I ended up modifying one of the packaged examples to suit my need and had the server running on Mac OS 10.4.? 它是如何工作的我最终修改了一个打包的示例以满足我的需要,并让服务器在Mac OS 10.4上运行。 Red5 basically grabbed the audio stream and saved the file to a directory on the machine. Red5基本上抓住了音频流并将文件保存到了机器上的目录中。 I had to then update the database to point to the audio file for the professor to be able to play it. 然后,我必须更新数据库以指向音频文件,以便教授能够播放它。 Note, I did not do any live modification or re-broadcasting of the stream; 注意,我没有对流进行任何实时修改或重播; in case that's part of the scope of your project. 如果这是您项目范围的一部分。

Anyway, Red5 didn't have much of a community at the time so I wasn't able to contribute what I had learned to their documentation but it seems like they're more active now and if you do choose to go with Red5 I would ask that you become involved in the project and help document it. 无论如何,Red5当时没有太多的社区,所以我无法将我学到的东西贡献给他们的文档,但现在似乎他们更活跃,如果你选择使用Red5,我会要求您参与项目并帮助记录它。

你可以看看haxevideo是否适合你的开发。

Media servers typically do just that - serve media. 媒体服务器通常就是这样 - 提供媒体服务。 Are you trying to consume streaming video in a flash application? 您是否尝试在Flash应用程序中使用流式视频? If so, either of the servers you mentioned should be suitable for that. 如果是这样,您提到的任何一台服务器都应该适合。

If you are, however, trying to capture and publish streaming video from flash, aside from webcam streams, AFAIK there's no great way to do it. 但是,如果您尝试从闪存中捕获和发布流式视频,除了网络摄像头流之外,AFAIK还没有很好的方法可以做到这一点。

For real-time publishing of webcam streams and other basic interaction, you may want to check out the Adobe LiveCycle collab service (codename Cocomo). 要实时发布网络摄像头流和其他基本交互,您可能需要查看Adobe LiveCycle协作服务(代号为Cocomo)。

We are now using crtmpserver. 我们现在使用crtmpserver。 A few notes: Flash needs to connect to rtmp://server:1935/appname (where appname is the application to use - these are configured on server side). 一些注意事项:Flash需要连接到rtmp:// server:1935 / appname(其中appname是要使用的应用程序 - 这些是在服务器端配置的)。 Even if there are multiple parts in the URL (separated by slashes), the entire combination is considered the appname (even though there appears to be an exception for playback, permitting the flv filename to be put there). 即使URL中有多个部分(由斜杠分隔),整个组合也被视为appname(即使播放时似乎有例外,允许将flv文件名放在那里)。

Recording happens by connecting to "flvplayback" application and then publishing by "somename" (with "record" or "append"), making the server write to (relative to CWD) applications/flvplayback/mediaFolder/somename.flv 通过连接到“flvplayback”应用程序然后通过“somename”(带有“record”或“append”)发布来进行录制,使服务器写入(相对于CWD)applications / flvplayback / mediaFolder / somename.flv

You cannot change the application name but it might look nicer to use one of the aliases of flvplayback in the URL (that doesn't affect the folder where the files go). 您无法更改应用程序名称,但在URL中使用其中一个flvplayback别名可能看起来更好(不会影响文件所在的文件夹)。 One of the default aliases is "live", so you may use "rtmp://server:1935/live" as the URL. 其中一个默认别名是“live”,因此您可以使用“rtmp:// server:1935 / live”作为URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM