How to stream h264 with udp gstreamer

a 夏天 提交于 2019-12-02 04:14:09

问题


I'm trying to stream a video with h264. Source is a Axis camera. I managed to stream jpeg with multicast but not h264.

With jpeg I used following command:

gst-launch-1.0 udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink

I tried to stream h264 but it fails, used following command:

gst-launch-1.0 -v udpsrc host=239.194.0.177 port=1026 ! rtph264depay ! ffdec_h264 ! xvimagesink

I get the following error:

ERROR: pipeline could not be constructed: no element "udpsrc".

With this line:

gst-launch-1.0 udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! h264parse

I did not get any errors but no video streamed and this was printed in terminal:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

I tried the commands from following pages:

Stream H.264 video over rtp using gstreamer

https://developer.ridgerun.com/wiki/index.php/Using_UDP_Multicast_with_GStreamer

http://labs.isee.biz/index.php/Example_GStreamer_Pipelines#H.264_RTP_Streaming

But could not get it to work.

When running in verbos mode I get litte more info.

Command:

gst-launch-1.0 -v udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp, media=video, payload=96, encoding-name=H264 ! rtph264depay ! avdec_h264 ! videoconvert ! fakesink

Output:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)video\,\ payload\=\(int\)96\,\ encoding-name\=\(string\)H264\,\ clock-rate\=\(int\)90000"
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)video\,\ payload\=\(int\)96\,\ encoding-name\=\(string\)H264\,\ clock-rate\=\(int\)90000"

How do I stream H264 via multicast with gstreamer?


回答1:


Too long for comment - and since nobody is answering posting this draft of thoughts as answer..

The first error about no element udpsrc is really weird. But I think its complaining about missing uri parameter. What version are you using? I do not have the host parameter for udpsrc..

In third pipeline it ends with h264parse - is this s typo? you need to decode the h264.. not just parse it:

gst-launch-1.0 udpsrc uri=udp://239.194.0.177:1026 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

Also add some logs (maybe with pastebin if too long) with running GST_DEBUG=3 gst-launch-1.0 .... or so.

What does it mean:

But could not get it to work

This does not say too much ;)

Usually when working with rtp you need to provide really all capabilities otherwise it may not link or play at all..

Maybe try with uridecodebin? Not sure if its the best idea:

gst-launch-1.0 uridecodebin uri=udp://etcetc:port ! videoconvert ! autovideosink

If you get any new infos/questions add them as updates to make the picture whole (for others as well..)

HTH



来源:https://stackoverflow.com/questions/39538695/how-to-stream-h264-with-udp-gstreamer

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