Gstreamer - stream h264 video from Logitech c920 over tcp

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 10:14:06

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/28294296/gstreamer-stream-h264-video-from-logitech-c920-over-tcp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!