【问题标题】:Stream H.264 video over rtp using gstreamer使用 gstreamer 通过 rtp 流式传输 H.264 视频
【发布时间】:2013-06-23 05:35:31
【问题描述】:

我是 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

有什么想法/建议吗? 谢谢,

【问题讨论】:

    标签: video-streaming h.264 gstreamer rtp


    【解决方案1】:

    filesrc 将从给定文件中读取数据作为原始字节;你不能只用x264enc 编码这些原始字节,你需要视频数据才能工作。在重新编码流之前尝试添加 demuxer/decoder),例如像这样:

    发件人:

    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
    

    【讨论】:

    • 感谢您提供原始/视频数据的提示,但我认为这仅解决了一部分问题。我尝试了带有 videotestsrc 的经典管道,但没有任何结果。即使使用以下管道,我也无法在另一端收到任何东西:gst-launch-1.0 -v videotestsrc ! udpsink host=192.128.52.128 port=9001 我感觉 udpsink 没有发送任何东西! PS:不是防火墙的问题,我都关闭了
    • 尝试使用:ffmpeg -i C:\tmp\sample_h264.mov -f mpegts udp://192.168.52.128:9001 ... 并且在另一端接收到流。但我想用 gstreamer 来做
    • videotestsrc ! udpsink 不是 RTP 流。你必须添加一个payloader
    • gst-launch-1.0 -v videotestsrc ! udpsink host=192.128.52.128 port=9001output: Setting pipeline to PAUSED ... Pipeline is 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 Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock
    • 最后,我认为问题与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
    猜你喜欢
    • 2013-05-01
    • 2013-09-22
    • 2022-08-09
    • 2023-03-17
    • 2012-04-25
    • 1970-01-01
    • 2013-07-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多