Gstreamer - 通过 tcp 从 Logitech c920 流式传输 h264 视频 [英] Gstreamer - stream h264 video from Logitech c920 over tcp
问题描述
我正在尝试从 Logitech c920 流式传输视频,它直接输出 h264.发送端是树莓派,接收端是 Windows 7 PC.使用 udp 可以在 Gstreamer 中完美运行:
I am trying to stream video from Logitech c920 which outputs h264 directly. The sending side is a Raspberry Pi and the receiving side is a Windows 7 PC. Using udp this works flawlessly in Gstreamer:
发件人:
gst-launch-1.0 -v v4l2src device=/dev/video0 !
video/x-h264,width=1280,height=720,framerate=30/1 ! h264parse ! rtph264pay
pt=127 config-interval=4 ! udpsink host=$myip port=$myport
接收方:
gst-launch-1.0 -e -v udpsrc port=5001 ! ^
application/x-rtp, payload=96 ! ^
rtpjitterbuffer ! ^
rtph264depay ! ^
avdec_h264 ! ^
autovideosink sync=false text-overlay=false
但是使用 tcp 这不起作用:
However using tcp this does not work:
发件人
gst-launch-1.0 -v v4l2src device=/dev/video0 !
video/x-h264,width=960,height=720,framerate=5/1 ! h264parse ! rtph264pay pt=96 config-interval=1
! gdppay ! tcpserversink host=$myip port=$myport
接收方:
gst-launch-1.0 -e -v tcpclientsrc host="172.17.166.255" port=5001 ! ^
application/x-gdp ! gdpdepay ! rtpjitterbuffer ! ^
rtph264depay ! ^
avdec_h264 ! ^
autovideosink sync=false text-overlay=false
我在接收方收到以下错误:
And I get the following error on the receiver side:
ERROR: from element /GstPipeline:pipeline0/GstGDPDepay:gdpdepay0: Could not decode stream.
Additional debug info:
gstgdpdepay.c(443): gst_gdp_depay_chain ():
/GstPipeline:pipeline0/GstGDPDepay:gdpdepay0:
could not create event from GDP packet
EOS on shutdown enabled -- waiting for EOS after Error
有趣的是:如果我在启动发送方之前启动接收方,我会在视频流中断前获得几秒钟.我怀疑这可能是 gdppay gdpdepay 的问题,但我不确定.
The funny thing is: if I start the receiving side right before i start the sender, I get the video stream for a couple of seconds before it breaks. I suspect this can be a problem with the gdppay gdpdepay, but I do not know for sure.
推荐答案
以下适用于通过 TCP 流式传输 h264:
The following works for streaming h264 over TCP:
发件人:
v4l2src device=/dev/video0 ! video/x-h264,width=320,height=90,framerate=10/1 !
tcpserversink host=192.168.0.4 port=5000
接收方:
tcpclientsrc host=192.168.0.4 port=5000 !
h264parse ! avdec_h264 !
autovideosink sync=true
显然 h264 可以通过 tcp 流式传输,而无需使用 gdppay/depay
Apparently the h264 can be streamed over tcp withoug the use of gdppay/depay
这篇关于Gstreamer - 通过 tcp 从 Logitech c920 流式传输 h264 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!