Gstreamer - 通过tcp从Logitech c920流式传输h264视频

时间:2015-02-03 08:23:07

标签: tcp raspberry-pi gstreamer h.264

我正在尝试从Logitech c920流式传输视频,直接输出h264。发送方是Raspberry Pi,接收方是Windows 7 PC。使用udp,这在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这不起作用:

发件人

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

我在接收方遇到以下错误:

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的一个问题,但我不确定。

1 个答案:

答案 0 :(得分:0)

以下适用于通过TCP传输h264:

发信人:

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可以通过使用gdppay / depay

在tcp上流式传输
相关问题