使用gstreamer在rtp上流式传输H.264视频 [英] Stream H.264 video over rtp using gstreamer

查看:1453
本文介绍了使用gstreamer在rtp上流式传输H.264视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是gstreamer的新手,并且正在尝试将其使用.我的第一个目标是在两个设备之间创建h264视频的简单rtp流.我正在使用以下两个管道:

I am newbie with gstreamer and I am trying to be used with it. My first target is to create a simple rtp stream of h264 video between two devices. I am using these two pipelines:

发件人: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

但是对于第一个(发送者),我遇到了以下错误:

But with the first one (the sender) I got the following error:

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 ...

我尝试了许多其他配置,但是找不到正确的管道.

I tried a lot of other configurations but I couldn’t find the right pipeline.

其他一些信息: Gstreamer版本:1.0.7 操作系统:Windows 7

Some other information: Gstreamer version: 1.0.7 OS: Windows 7

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

Any idea/suggestion? Thx,

推荐答案

filesrc将从原始文件中读取数据作为原始字节;您不能仅使用x264enc对这些原始字节进行编码,则需要视频数据才能使其正常工作.在重新编码流之前,尝试添加 demuxer / decoder ),例如像这样的东西:

filesrc will read the data from the given file as raw bytes; you cannot just encode these raw bytes with x264enc, you will need video-data for this to work. try adding a demuxer/decoder before re-encoding the stream), e.g. something like this:

发件人:

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

您应该使用测试视频来快速检查此方法是否有效:

You should do a quick check whether this works by using a test video soure:

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

这篇关于使用gstreamer在rtp上流式传输H.264视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆