0

Hardware: Jetson AGX ORIN
Software: Jetpack 5.0.2

I have been attempting to send a video file via UDP using ffmpeg:

ffmpeg -stream_loop -1 -re -i test.ts -map 0 -c copy -preset ultrafast -f mpegts "udp://127.0.0.1:5000"

And receiving the same stream via UDP using gstreamer:

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, media=video, clock-rate=90000, encoding-name=H264 ! rtph264depay ! decodebin ! videoconvert ! aasink

But I get an error on the receiving gstreamer end:

/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0: Could not decode stream.
Additional debug info:
gstrtpbasedepayload.c(505): gst_rtp_base_depayload_handle_buffer (): 
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0:
Received invalid RTP payload, dropping
ERROR: from element /GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0:
The stream is in the wrong format.
Additional debug info:
gstrtph264depay.c(1298): gst_rtp_h264_depay_process ():
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0:
NAL unit type 27 not supported yet

More detailed information on the video file:

Original ID: 1002
Codec: H264 - MPEG-4 AVC (part 10) (h264)
Type: Video
Video resolution: 1920x1080
Buffer dimensions: 1920x1088
Frame rate: 30
Decoded format: 
Orientation: Top left
Chroma location: left

When I listen with the command gst-launch-1.0 -v udpsrc port=5000 ! fakesink dump=1, it is quite apparent that the packets from FFMPEG are being received.
I am not sure why gstreamer’s rtph264depay says the stream is in the wrong format.

Would I have to check some details on the FFMPEG side? This is what information FFMPEG shows by default while running.

Input #0, mpegts, from 'test.ts':
  Duration: 00:00:57.36, start: 20902.827056, bitrate: 2504 kb/s
  Program 1
    Stream #0:0[0x3ea]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Output #0, mpegts, to 'udp://127.0.0.1:5000':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  611 fps= 30 q=-1.0 Lsize=    5847kB time=00:00:20.62 bitrate=2323.0kbits/s speed=   1x
video:5350kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.301388%

Any advice would be appreciated.

2
  • Not a specialist, but I'm guessing you are telling ffmpeg to send mpegts while gstreamer is apparently expecting RTP. See superuser.com/questions/1125344/streaming-in-ffmpeg-using-rtp for ffpmeg examples sending RTP.
    – jcaron
    Commented Jan 24 at 13:37
  • Yes, you are right. More details below where I answer my own question.
    – aron.h
    Commented Jan 25 at 17:35

1 Answer 1

1

Problem solved.
Continue reading to see troubleshooting steps or skip to TLDR at the end.


I used export GST_DEBUG=*FACTORY*:4 to later get debug info to see which plugins were being used.
I then ran this receiving pipeline:
gst-launch-1.0 uridecodebin uri="udp://127.0.0.1:5000" ! fakesink

Debug information indicated that the pipeline that gstreamer chose to generate was something along these lines:
gst-launch-1.0 udpsrc port=5000 ! tsdemux ! multiqueue ! h264parse ! nvv4l2decoder ! fakesink

I adjusted that to better suit my needs as well as adding a clock-rate to reduce stuttering.
gst-launch-1.0 udpsrc uri="udp://127.0.0.1:5000" ! video/mpegts, systemstream=true, clock-rate=90000 ! tsdemux ! queue ! h264parse ! avdec_h264 ! videoconvert ! aasink


TLDR;
To make this work I could have done one of two things:

  • not use an rtp depayloader in the receiving gstreamer pipeline
  • make sure the sending ffmpeg pipeline was sending rtp packets

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .