简体   繁体   中英

Gstreamer - stream h264 video from Logitech c920 over tcp

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:

Sender:

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

Receiver:

gst-launch-1.0 -e -v udpsrc port=5001 ! ^
application/x-rtp, payload=96 ! ^
rtpjitterbuffer ! ^
rtph264depay ! ^
avdec_h264 ! ^
autovideosink sync=false text-overlay=false

However using tcp this does not work:

Sender

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

Receiver:

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

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.

The following works for streaming h264 over TCP:

Sender:

v4l2src device=/dev/video0 ! video/x-h264,width=320,height=90,framerate=10/1 !
tcpserversink host=192.168.0.4 port=5000

Receiver:

tcpclientsrc  host=192.168.0.4 port=5000 !
h264parse   ! avdec_h264  ! 
autovideosink sync=true

Apparently the h264 can be streamed over tcp withoug the use of gdppay/depay

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM