How to stream h264 with udp gstreamer

13,059

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

Share:
13,059
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    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?

  • Admin
    Admin over 7 years
    Tried your command but no stream opened, same message as before ie nothing happends after New clock: GstSystemClock and no errors. Also tried adding fakesink after every element but did not get anything out of that. There seems to be nothing wrong with the commands but for some reason no window containing the stream opens with h264. I double checked that the camera is sending multicast with h264 and wiresharked the network to verify that the packets are actually sent. So I now that packets are sent. Also no extra info when using GST_DEBUG=3 was printed.
  • Admin
    Admin over 7 years
  • nayana
    nayana over 7 years
    @S4M1R hm I found two weird things, first no such pad 'sink' in element "udpsrc0" which means you are maybe in your code requesting sink pad of udpsrc which has no sense (it has only src pad) .. and second I see at the end <udpsrc0> marking pending DISCONT .. which means some data are too late