c920流式传输h264视频

c920流式传输h264视频

本文介绍了Gstreamer-通过TCP从Logitech c920流式传输h264视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Logitech c920流式传输视频,后者直接输出h264.发送方是Raspberry Pi,接收方是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

显然,无需使用gdppay/depay,就可以通过tcp传输h264

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

这篇关于Gstreamer-通过TCP从Logitech c920流式传输h264视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:36