Python 在基于 Web 的聊天/视频会议应用程序的 HTML5 websocket 服务器中斩波媒体流
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4242081/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Chopping media stream in HTML5 websocket server for webbased chat/video conference application
提问by Wouter Dorgelo
We are currently working on a chat + (file sharing +) video conference application using HTML5 websockets. To make our application more accessible we want to implement Adaptive Streaming, using the following sequence:
我们目前正在使用 HTML5 websockets开发一个聊天+(文件共享+)视频会议应用程序。为了使我们的应用程序更易于访问,我们希望使用以下序列实现自适应流:
- Raw audio/video data client goes to server
- Stream is split into 1 second chunks
- Encode stream into varying bandwidths
- Client receives manifest file describing available segments
- Downloads one segment using normal HTTP
- Bandwidth next segment chosen on performance of previous one
- Client may select from a number of different alternate streams at a variety of data rates
- 原始音频/视频数据客户端转到服务器
- 流被分成 1 秒的块
- 将流编码为不同的带宽
- 客户端接收描述可用段的清单文件
- 使用普通 HTTP 下载一段
- 根据前一个的性能选择下一个段的带宽
- 客户端可以从多种不同数据速率的替代流中进行选择
So.. How do we split our audio/video data in chunks with Python?
那么.. 我们如何使用 Python 将我们的音频/视频数据分成块?
We know Microsoft already build the Expression Encoder 2which enables Adaptive Streaming, but it only supports Silverlight and that's not what we want.
我们知道微软已经构建了支持自适应流的Expression Encoder 2,但它只支持 Silverlight,这不是我们想要的。
Edit:
There's also an solution called FFmpeg (and for Python a PyFFmpeg wrapper), but it only supports Apple Adaptive streaming.
编辑:
还有一个叫做 FFmpeg 的解决方案(对于 Python 来说是一个 PyFFmpeg 包装器),但它只支持 Apple Adaptive 流。
采纳答案by mjhm
I think ffmpegis the main tool you'll want to look at. It's become most well supported open source media manipulator. There is a python wrapperfor it. Though it is also possible to access the command line through the subprocess module.
我认为ffmpeg是您想要查看的主要工具。它已成为最受支持的开源媒体操纵器。它有一个python 包装器。虽然也可以通过 subprocess 模块访问命令行。

