在浏览器中显示本地 gstreamer 流

发布于 2024-09-18 17:22:32 字数 380 浏览 3 评论 0原文

我有一个摄像头输入到 Linux 机器中,使用 V4l2 接口作为 gstreamer 管道的源。我正在构建一个界面来控制相机,我想用 HTML/javascript 来实现,与本地服务器通信。问题是将 gst 管道中的 feed 获取到浏览器中。这样做的选项似乎是:

  • 从 gst 到 v4l2 设备的环回,使用 flash 的网络摄像头支持显示输出
  • 在浏览器中显示的 MJPEG 流
  • 输出由 flash 显示的 RTSP 流
  • 编写浏览器插件
  • 覆盖浏览器上的本机 X 应用程序

以前有人有解决此问题的经验吗?最重要的要求是提要尽可能接近实时。如果可能的话,我想避免使用闪光灯,但事实可能并非如此。任何帮助将不胜感激。

I have a camera feed coming into a linux machine using a V4l2 interface as the source for a gstreamer pipeline. I'm building an interface to control the camera, and I would like to do so in HTML/javascript, communicating to a local server. The problem is getting a feed from the gst pipeline into the browser. The options for doing so seem to be:

  • A loopback from gst to a v4l2 device, which is displayed using flash's webcam support
  • Outputting a MJPEG stream which is displayed in the browser
  • Outputting a RTSP stream which is displayed by flash
  • Writing a browser plugin
  • Overlaying a native X application over the browser

Has anyone had experience solving this problem before? The most important requirement is that the feed be as close to real time as possible. I would like to avoid flash if possible, though it may not be. Any help would be greatly appreciated.

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

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

发布评论

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

评论(2

少女的英雄梦 2024-09-25 17:22:32

您已经考虑过多种解决方案。您还可以将 ogg/vorbis/theora 或 vp8 流式传输到icecast 服务器,请参阅 OLPC GStreamer wiki 获取示例

由于您也在寻找 python 解决方案(根据您的标签),您是否考虑过使用 Flumotion ?它是一个使用 Twisted 在 GStreamer 之上编写的流服务器,您可以将其与您自己的解决方案集成。它可以通过 HTTP 进行流式传输,因此您不需要icecast 服务器。

根据编解码器的不同,可以进行各种调整以实现低延迟。通常,在本地使用 Flumotion,您可能会得到几秒的延迟,我相信这可以降低(x264enc 可以调整到小于一秒的延迟,iirc)。通常,您必须减少关键帧距离,并将运动矢量估计限制为附近的几个帧:但这可能会降低质量并提高比特率。

You already thought about multiple solutions. You could also stream in ogg/vorbis/theora or vp8 to an icecast server, see the OLPC GStreamer wiki for examples.

Since you are looking for a python solution as well (according to your tags), have you considered using Flumotion? It's a streaming server written on top of GStreamer with Twisted, and you could integrate it with your own solution. It can stream over HTTP, so you don't need an icecast server.

Depending on the codecs, there are various tweaks to allow low-latency. Typically, with Flumotion, locally, you could get a few seconds latency, and that can be lowered I believe (x264enc can be tweaked to reach less than a second latency, iirc). Typically, you have to reduce the keyframe distance, and also limit the motion-vector estimation to a few nearby frames: that will probably reduce the quality and raise the bitrate though.

很快妥协 2024-09-25 17:22:32

您的目标浏览器是什么?如果您忽略 Internet Explorer,您应该能够使用该标签将 OGG/Theora 视频和/或 WebM 视频直接流式传输到浏览器。如果您还需要支持 IE,那么您可能会被简化为 Flash 小程序。我刚刚使用 Flumotion 和免费版本的 Flowplayer http://flowplayer.org/ 设置了一个网络流,它正在运行很好。 Flowplayer 有很多高级功能,我什至还没有开始探索。

What browsers are you targeting? If you ignore Internet Explorer, you should be able to stream OGG/Theora video and/or WebM video direct to the browser using the tag. If you need to support IE as well though you're probably reduced to a flash applet. I just set up a web stream using Flumotion and the free version of Flowplayer http://flowplayer.org/ and it's working very well. Flowplayer has a lot of advanced functionality that I have barely even begun to explore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文