首页 文章

使用Gstreamer的Raspberry Pi USB网络摄像头流到计算机

提问于
浏览
1

我有一个fisheye usb网络摄像头连接到覆盆子pi,我正试图流到电脑 . 我玩过ffmpeg,看起来有点迟了超过320x240 . 从我所看到的,人们对gstreamer感到满意 .

所以我测试了usb网络摄像头,它在本地工作

gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480' ! glimagesink

这些是我一直试图将视频用于计算机的命令 . 但是,我所看到的只是一扇绿色的窗户 .

TCP服务器: gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! x264enc byte-stream=true ! rtph264pay ! gdppay ! tcpserversink host=192.168.200.38 port=5000 sync=false

TCP客户端: gst-launch-1.0 -v tcpclientsrc host=192.168.200.38 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

要么

UDP服务器: gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! x264enc byte-stream=true ! rtph264pay ! gdppay ! udpsink host=192.168.200.37 port=5000 sync=false

UDP客户端: gst-launch-1.0 -v udpsrc port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

我想我必须以某种方式错误地管道插件 . 任何建议表示赞赏 .

2 回答

  • 0

    首先尝试以下方法:

    • 在x264enc之后添加 tune=zerolatency (这通常需要在嵌入式系统中)

    • 重新检查IP和连接(我看到IP在TCP和UDP情况下有所不同)

    如果问题还没有解决,请说明一些要点:

    • 您的相机提供了哪种视频格式(在第一个命令后添加" -v",它会告诉您)

    • x264enc是否支持该格式?
      (根据its manual,x264enc支持I420,YV12,Y42B,Y444,NV12,I420_10LE,I422_10LE,Y444_10LE)

    • 如果不支持该格式,请尝试其他相机或其他编码器 .

    • 如果支持,请尝试确认您的编码命令(使用 filesink / fakesink )和解码命令(使用 videotestsrc

  • 1

    所以我把东西弄得一整天都搞定了 . 我会发布到目前为止的内容 . 队列让rpi多线程h264编码部分,我为x264enc编写了omxh264enc,因为它是openmax / accelerated . 两种变化都有助于延迟

    我想我不需要gdppay? (看到有人没有它在这里流Stream webcam video with gstreamer 1.0 over UDP to PC

    rpi方面

    gst-launch-1.0 -vv -e v4l2src device=/dev/video0 ! "video/x-raw,width=640,height=480" ! queue ! omxh264enc ! h264parse ! rtph264pay ! udpsink host=192.168.200.37 port=5000

    电脑方面

    gst-launch-1.0 -vv -e udpsrc port=5000 ! application/x-rtp, payload=96 ! rtph264depay ! queue ! avdec_h264 ! videoconvert ! autovideosink sync=false

相关问题