Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stream H.264 video over rtp using gstreamer

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,

like image 723
abir Avatar asked Jun 26 '13 07:06

abir


People also ask

Does GStreamer support RTSP?

GStreamer - ZED RTSP Server ZED RTSP Server is a GStreamer application for Linux operating system that allows to instantiate an RTSP server from a text launch pipeline using the “gst-launch” style.


1 Answers

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
like image 182
umläute Avatar answered Oct 19 '22 23:10

umläute