Stream H.264 video over rtp using gstreamer

匿名 (未验证) 提交于 2019-12-03 01:09:02

问题:

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:

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

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

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

Any idea/suggestion? Thx,

回答1:

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:

Sender:

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 


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