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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 14:55:16  来源:igfitidea点击:

Chopping media stream in HTML5 websocket server for webbased chat/video conference application

pythonhtmlstreamsplit

提问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开发一个聊天+(文件共享+)视频会议应用程序。为了使我们的应用程序更易于访问,我们希望使用以下序列实现自适应流:

  1. Raw audio/video data client goes to server
  2. Stream is split into 1 second chunks
  3. Encode stream into varying bandwidths
  4. Client receives manifest file describing available segments
  5. Downloads one segment using normal HTTP
  6. Bandwidth next segment chosen on performance of previous one
  7. Client may select from a number of different alternate streams at a variety of data rates
  1. 原始音频/视频数据客户端转到服务器
  2. 流被分成 1 秒的块
  3. 将流编码为不同的带宽
  4. 客户端接收描述可用段的清单文件
  5. 使用普通 HTTP 下载一段
  6. 根据前一个的性能选择下一个段的带宽
  7. 客户端可以从多种不同数据速率的替代流中进行选择

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 模块访问命令行

回答by Wouter Dorgelo

I've found some nice articlesabout how other people build a stream segmenterfor other platforms, so now we know how to build one in Python.

我找到了一些关于其他人如何为其他平台构建一个很好的文章stream segmenter,所以现在我们知道如何用 Python 构建一个。