【问题标题】:Extract h264 stream from USB webcam (logitech C920)从 USB 网络摄像头中提取 h264 流(罗技 C920)
【发布时间】:2017-10-26 05:39:35
【问题描述】:

所以,我开始使用 gstreamer,我可以做非常简单的管道,例如

gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=10/1 ! videoconvert ! autovideosink

现在,由于我的 USB 网络摄像头(即 video1,video0 是计算机的内置摄像头)支持 h264(我已使用 lsusb 检查过),我想尝试直接获取 h264 提要。我知道这个提要是在 mjpeg 中混合的,但是在网络上环顾四周,gstreamer 似乎仍然能够得到它。

由于我的最终目标是从 Beaglebone 流式传输,因此我尝试使用提供给 this post 的解决方案(从不同的终端添加侦听器):

#sender
gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-264,width=320,height=90,framerate=10/1 ! tcpserversink host=192.168.148.112 port=9999

但这会产生以下错误:

WARNING: erroneous pipeline: could not link v4l2src0 to tcpserversink0

我还尝试了与我的第一个命令类似的操作,将源代码从 raw 更改为 h264(基于 that post,尝试那里给出的完整命令会给出相同的错误消息)

gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-h264,width=640,height=480,framerate=10/1 ! h264parse ! avdec_h264 ! autovideosink

但同样,这也不起作用:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 0:00:00.036309961
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

我承认这让我很抓狂:查看 SO 或网络上的其他地方,似乎有很多人使用与我拥有的网络摄像头完全相同的网络摄像头(罗技 C920),但我一个接一个地遇到问题。

从该网络摄像头中提取 h264 的正确管道示例是什么?

【问题讨论】:

    标签: gstreamer gst-launch


    【解决方案1】:

    你肯定需要在它击中电线之前使用一个有效载荷。例如 rtph264pay。这是一个无法测试的示例,因为我没有可用的硬件。如果这不能引导您朝着正确的方向前进,我有来自其他来源的工作 udp 示例。

    服务器

    gst-launch v4l2src device=/dev/video1 \
    ! video/x-264,width=320,height=90,framerate=10/1 \
    ! x264enc \
    ! queue \
    ! rtph264pay, config-interval=3, pt=96, mtu=1500 \
    ! queue \
    ! tcpserversink host=127.0.0.1 port=9002
    

    客户

    gst-launch tcpserversrc host=127.0.0.1 port=9002 \
    ! application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96 \
    ! rtph264depay \
    ! video/x-h264 \
    ! queue \
    ! ffdec_h264 \
    ! queue \
    ! xvimagesink
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-31
      • 1970-01-01
      • 2013-08-12
      • 2013-09-18
      • 1970-01-01
      • 2018-09-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多