使用开源媒体服务器进行 Flash 网络摄像头/麦克风捕获
从 Flash 捕获视频需要媒体服务器,但它们似乎都没有任何可用的文档(甚至没有 API 文档或其他源代码注释)。我更喜欢crtmpserver,因为我的应用程序是用C++编写的,它需要实时接收和处理捕获的数据。然而,Red5 显然是一个更成熟、更知名的项目,所以我也认为这是一个选择。 Adobe FMS 太昂贵,并且可能很难与我的应用程序集成,因为 Adobe 从未提及过此类用例。
据我所知,必须为媒体服务器编写一个“应用程序”(它们不附带任何可用的东西),然后必须转发数据以进行实际处理。应用程序可以从媒体服务器获取什么类型的数据,它是普通的 FLV 流还是还有其他内容(带宽协商等)?
对 Flash 端进行编码不是问题,有很多示例(即使它们没有说明应如何构建媒体服务器 URL)。
实际问题:服务器端如何工作(高级视图)以及有什么可以让人们开始使用实时捕获功能吗?
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). I would prefer crtmpserver because my application is written in C++ and it needs to receive and process the captured data in real time. However, Red5 is clearly a lot more mature and better known project so I do consider that an option too. Adobe FMS is too expensive and might be difficult to integrate with my application as Adobe never mentions such use case.
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)?
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).
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
几年前,我正在开发一个电子学习项目,该项目允许学生录制答案(在我的例子中只有音频),教授可以听它并对学生进行评分。
我们考虑了 Adobe FMS、Wowza Media Server (http://www.wowzamedia.com) 和 Red5。最终选择了 Red5,因为它是唯一一个免费的开源选项,尽管它缺乏很多文档,但足够稳定,可以在该项目中使用。
它是如何工作的,我最终修改了打包示例之一以满足我的需要,并使服务器在 Mac OS 10.4 上运行。 Red5 基本上抓取了音频流并将文件保存到机器上的目录中。然后我必须更新数据库以指向音频文件,以便教授能够播放它。请注意,我没有对流进行任何实时修改或重新广播;如果这是您项目范围的一部分。
不管怎样,Red5 当时没有太多的社区,所以我无法将我学到的东西贡献给他们的文档,但看起来他们现在更活跃了,如果你选择使用 Red5,我会要求您参与该项目并帮助记录它。
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. 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.
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.? Red5 basically grabbed the audio stream and saved the file to a directory on the machine. 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.
您可以查看 haxevideo 是否适合您的开发。
You could take a look if haxevideo might be suitable for your development.
媒体服务器通常就是这样做的——提供媒体服务。您是否尝试在 Flash 应用程序中使用流媒体视频?如果是这样,您提到的任何服务器都应该适合于此。
但是,如果您尝试从 Flash 捕获和发布流视频(除了网络摄像头流),据我所知,没有什么好方法可以做到这一点。
对于实时发布网络摄像头流和其他基本交互,您可能需要查看 Adobe LiveCycle 协作服务(代号 Cocomo)。
Media servers typically do just that - serve media. Are you trying to consume streaming video in a flash application? 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.
For real-time publishing of webcam streams and other basic interaction, you may want to check out the Adobe LiveCycle collab service (codename Cocomo).
我们现在使用crtmpserver。一些注意事项: Flash 需要连接到 rtmp://server:1935/appname (其中 appname 是要使用的应用程序 - 这些是在服务器端配置的)。即使 URL 中有多个部分(用斜杠分隔),整个组合也被视为应用程序名称(即使播放似乎有例外,允许将 flv 文件名放在那里)。
通过连接到“flvplayback”应用程序然后通过“somename”发布(使用“record”或“append”)进行录制,使服务器写入(相对于 CWD)applications/flvplayback/mediaFolder/somename.flv
您无法更改应用程序名称,但在 URL 中使用 flvplayback 的别名之一可能看起来更好(这不会影响文件所在的文件夹)。默认别名之一是“live”,因此您可以使用“rtmp://server:1935/live”作为 URL。
We are now using 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). 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).
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
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). One of the default aliases is "live", so you may use "rtmp://server:1935/live" as the URL.