0

I have a third party application that reads data from a thermal camera and generates a RTP stream to a given UDP source. I am trying to wrap this RTP into a RTSP stream but I am running into problems...

The third party application basically runs gstreamer with this command

appsrc format=GST_FORMAT_TIME is-live=true block=true caps=video/x-raw,width=640,height=480,format=GRAY8,clock-rate=90000,framerate=10/1 ! openjpegenc ! rtpj2kpay ! udpsink host=127.0.0.1 port=3000

Using the command below I can visualize the stream on my machine

gst-launch-1.0 udpsrc port=3000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG2000, sampling=(string)GRAYSCALE, width=(int)640, height=(int)480, payload=(int)96" ! queue ! rtpj2kdepay ! openjpegdec ! videoconvert ! xvimagesink

However when trying to use the default RTP to RTSP application example using https://github.com/freedesktop/gstreamer-gst-rtsp-server/blob/master/examples/test-launch.c to just forward it with a RTSP container the connection fails with VLC. Command below:

./rtp-src-to-rtsp '( udpsrc port=3000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG2000, sampling=(string)GRAYSCALE, width=(int)640, height=(int)480, payload=(int)96" ! queue ! rtpj2kdepay ! rtpj2kpay )'

Any light on what I am doing wrong? VLC gives only a non-descriptive error

live555 error: Nothing to play for rtsp://{IP}:{PORT}/test
Milardo
  • 37
  • 7

1 Answers1

1

It might be a lack of support of J2K in VLC (I'm using revision 3.0.8-0). Simulating your source with:

gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,framerate=10/1,format=GRAY8 ! openjpegenc ! rtpj2kpay ! udpsink host=127.0.0.1 port=3000

and relaying as RSTP with:

./test-launch "udpsrc port=3000 auto-multicast=0 ! application/x-rtp,encoding-name=JPEG2000,sampling=GRAYSCALE ! queue ! rtpj2kdepay ! image/x-jpc ! jpeg2000parse ! rtpj2kpay name=pay0 "

works on Linux with X using:

gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test ! application/x-rtp, encoding-name=JPEG2000,sampling=GRAYSCALE ! rtpj2kdepay ! jpeg2000parse ! openjpegdec ! videoconvert ! xvimagesink -v

Though, I haven't been able to receive with VLC, nor able to make a correct J2K/RTP SDP for VLC nor ffmpeg. Someone better skilled may further advise.

SeB
  • 1,159
  • 6
  • 17
  • This is more than sufficient. I should read more about why this " image/x-jpc ! jpeg2000parse" is necessary. But this is on me! Thanks a lot – Milardo Mar 11 '22 at 03:30
  • Also for future viewers, this cannot be opened in VLC nor OpenCV but its a good starting point. I'll figure out a way around it even if I have to re-encode it... – Milardo Mar 11 '22 at 03:35
  • For now I'll be re-enconding and this enables VLC, etc. ```./test-launch "udpsrc port=3000 auto-multicast=0 ! application/x-rtp,encoding-name=JPEG2000,sampling=GRAYSCALE ! queue ! rtpj2kdepay ! openjpegdec ! videoconvert ! video/x-raw, format=I420 ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! video/x-h264, stream-format=byte-stream ! rtph264pay name=pay0 pt=96 "``` – Milardo Mar 11 '22 at 12:12