使用 Python 传输音频和视频

发布于 2024-12-13 11:13:43 字数 253 浏览 4 评论 0原文

我需要制作一个流式传输实时多媒体的应用程序。目前,我的应用程序正在从网络摄像头获取图像帧(使用 OpenCV)并将其发送到客户端。它还使用 pymedia 模块发送音频。问题是到达客户端的图像和音频数据包不同步。

所以我有以下问题:

  1. python 中是否有用于实时多媒体流的模块?
  2. 我可以以某种方式为客户端同步音频和图像帧吗?

附言。 pymedia 自 2006 年以来一直没有开发并且无法运行。

I need to make an application which streams live multimedia. At present my application is taking image frames from a webcam (using OpenCV) and sending it to the client. It is also sending audio using pymedia module. The problem is that both the image and audio packets that arrive at the client are out of sync.

So I have following questions:

  1. Is there any module in python for live-multimedia streaming?
  2. Can I make the audio and image frames somehow in sync for the client?

PS. pymedia has not been in development since 2006 and is not working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我的影子我的梦 2024-12-20 11:13:43

您可以使用 gstreamer 的 python 模块。我的意思是上面提到的gst-python。使用rtmp协议同步客户端/服务器视频。上次我使用gst-python时,不支持rtmp。当时,我的解决方案是限制缓冲区大小。当缓冲区已满时,最旧的帧将被丢弃。

You can use gstreamer's python module. I mean gst-python mentioned above. Use rtmp protocol to synchronize client/server videos. Last time I use gst-python, there was no support for rtmp. At the time, my solution was to limit buffer size. When buffer gets full oldest frames will be dropped.

拥抱我好吗 2024-12-20 11:13:43

您可以尝试 gst-python 模块。

有关更多详细信息,请参阅 gstPython 文档

You can try gst-python module.

refer to the gstPython Documentation for more detail.

浅听莫相离 2024-12-20 11:13:43

您需要的是一个执行多媒体流的命令行应用程序,它应该比 Python 模块更容易找到。然后,您的 Python 应用程序将使用 subprocess.Popen() 调用流应用程序,如下所示:

from subprocess import Popen, PIPE

cmd = "c:\Program Files\appdir\streamer.exe"
subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE).communicate())

What you need is a command-line application that does multimedia streaming, which should be much easier to find than a Python module. Your Python application would then call the streaming app using subprocess.Popen(), something like:

from subprocess import Popen, PIPE

cmd = "c:\Program Files\appdir\streamer.exe"
subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE).communicate())
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文