使用GStreamer通过RTP传输H.264视频流

17

我是一个gstreamer的新手,正在尝试使用它。我的第一个目标是在两个设备之间创建一个简单的h264视频rtp流。我正在使用这两个管道:

发送端:gst-launch-1.0 -v filesrc location=c:\\tmp\\sample_h264.mov ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5000

接收端:gst-launch-1.0 -v udpsrc port=5000 ! rtpmp2tdepay ! decodebin ! autovideosink

但是在第一个(发送)中,我遇到了以下错误:

Setting pipeline to PAUSED ...
Pipeline is PE*R*O L(LgIsNtG- l.a.u.n
h-1.0:5788): CRITICAL **: gst_adapter_map: assertion `size > 0' failed
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2812): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming task paused, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

我尝试了很多其他配置,但我找不到合适的管道。
其他信息: Gstreamer 版本:1.0.7 操作系统:Windows 7
有什么想法/建议吗? 谢谢。
1个回答

12
< p > filesrc 会将给定文件中的数据作为原始字节读取; 您不能仅使用 x264enc 对这些原始字节进行编码,您需要视频数据才能使其工作。尝试在重新编码流之前添加解复用器/解码器,例如像这样的内容:

发送方:

gst-launch-1.0 -v \
   filesrc location=/tmp/sample_h264.mov
   ! qtdemux \
   ! h264parse \
   ! ffdec_h264 \
   ! ffmpegcolorspace \
   ! x264enc \
   ! rtph264pay \
   ! udpsink host=127.0.0.1 port=5000

你应该通过使用测试视频源来快速检查是否正常工作:

gst-launch-1.0 -v \
   videotestsrc 
   ! x264enc \
   ! rtph264pay \
   ! udpsink host=127.0.0.1 port=5000

1
谢谢您提供的原始/视频数据提示,但我认为这只解决了问题的一部分。我尝试使用videotestsrc进行经典管道测试,但是没有任何东西传输到另一侧。即使使用以下管道,我也无法在另一侧接收到任何内容: gst-launch-1.0 -v videotestsrc ! udpsink host=192.128.52.128 port=9001 我有一种感觉,udpsink没有发送任何内容! PS:这不是防火墙的问题,我已将其全部停用。 - abir
尝试使用以下命令: gst-launch-1.0 filesrc location=C:\tmp\sample_h264.mov ! qtdemux ! h264parse ! rtph264pay ! udpsink host=192.168.52.128 port=9001 然后,在另一侧接收该流。 - abir
videotestsrc ! udpsink 不是 RTP 流。你需要添加一个 payloader。 - umläute
gst-launch-1.0 -v videotestsrc!udpsink host = 192.128.52.128 port = 9001 输出: 将管道设置为 PAUSED ... 管道 PREROLLING... /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, framerate=(fraction)30/1 /GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)320, height=(int)240, framerate=(fraction)30/1 管道已预滚 ... 将管道设置为 PLAYING ... 新时钟:GstSystemClock - abir
即使使用了rtph264pay,我仍然得到了相同的结果。 - abir
2
最后,我认为问题与Windows有关。以下两个管道在两个不同的Ubuntu虚拟机之间工作正常,但在Windows上不行:发送方:gst-launch-1.0 -v filesrc location=/home/ … /sample_h264.mov ! decodebin ! x264enc ! rtph264pay ! udpsink host=192.168.52.129 port=9001接收方:gst-launch-1.0 -v udpsrc port=9001 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink - abir

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接