problem playing rtsp / H264 stream

1,330 views
Skip to first unread message

Jason Thomas

unread,
Sep 5, 2022, 4:29:10 AM9/5/22
to gstreamer-java

I am using this:

Bin bin = Gst.parseBinFromDescription("rtspsrc location=rtsp://jason:mypas...@192.168.1.212:554/stream0 ! rtph264depay ! h264parse ! avdec_h264 ! videoscale ! videoconvert ! capsfilter caps=video/x-raw,width=640,height=480",
true);

I receive the following error output:

0:00:01.586895897 165175 0x7f4a2c003aa0 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<fakesrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:01.586923329 165175 0x7f4a2c003980 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<fakesrc1:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:01.666459883 165175 0x7f4a2c003f00 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<udpsrc1> error: Internal data stream error.
0:00:01.666488382 165175 0x7f4a2c003f00 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<udpsrc1> error: streaming stopped, reason not-linked (-1)
0:00:01.710626831 165175 0x7f49f401d180 WARN                 default gst/parse/grammar.y:540:gst_parse_no_more_pads:<rtspsrc0> warning: Delayed linking failed.
0:00:01.710665327 165175 0x7f49f401d180 WARN                 default gst/parse/grammar.y:540:gst_parse_no_more_pads:<rtspsrc0> warning: failed delayed linking some pad of GstRTSPSrc named rtspsrc0 to some pad of GstRtpH264Depay named rtph264depay0
0:00:01.787742011 165175 0x7f4a2c056400 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<udpsrc3> error: Internal data stream error.
0:00:01.787760656 165175 0x7f4a2c056400 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<udpsrc3> error: streaming stopped, reason not-linked (-1)

SwingPlayer does work when using the default webcam.  Also, this works using gst-launch-1.0.  Any ideas on why it would behave differently between gst-launch and Java?  Thanks for any advice or tips!

-Jason


Neil C Smith

unread,
Sep 5, 2022, 4:40:12 AM9/5/22
to gstream...@googlegroups.com
On Mon, 5 Sept 2022 at 09:29, Jason Thomas <katsoft...@gmail.com> wrote:
> Bin bin = Gst.parseBinFromDescription("rtspsrc location=rtsp://jason:mypas...@192.168.1.212:554/stream0 ! rtph264depay ! h264parse ! avdec_h264 ! videoscale ! videoconvert ! capsfilter caps=video/x-raw,width=640,height=480",
> true);
...
> SwingPlayer does work when using the default webcam. Also, this works using gst-launch-1.0. Any ideas on why it would behave differently between gst-launch and Java? Thanks for any advice or tips!

Actually, it wouldn't work in gst-launch either if you were actually
trying the same thing. One day we need to update that example to use
Gst.parseLaunch(), which is what gst-launch is using - it causes too
much confusion. You're putting the elements inside a Bin (container)
there, and passing `true` to ghost the pads. This only works properly
when the elements inside don't have sometimes / request pads that only
appear after the pipeline starts rolling.

To make this work with parseLaunch you'll have to add "! appsink
name=sink" on the end, and extract the AppSink element by name to pass
to the Swing component constructor.

The shorter answer is to base this on the video player example
instead. Use PlayBin to play the rtsp URI unless you have a real need
to configure the pipeline yourself. And even then, you can use
listeners on the PlayBin to configure individual elements in most
cases.

Best wishes,

Neil

--
Neil C Smith
Codelerity Ltd.
www.codelerity.com

Codelerity Ltd. is a company registered in England and Wales
Registered company number : 12063669
Registered office address : Office 4 219 Kensington High Street,
Kensington, London, England, W8 6BD

Jason Thomas

unread,
Sep 5, 2022, 9:56:37 AM9/5/22
to gstream...@googlegroups.com
Thank you, it works! For some reason playbin isn't working (even from gst-launch-1.0), so I have to do all this.
pipeline = (Pipeline) Gst.parseLaunch("rtspsrc location=rtsp://jason:mypas...@192.168.1.212:554/stream0 ! rtph264depay ! h264parse ! avdec_h264 ! videoscale ! videoconvert ! capsfilter caps=video/x-raw,width=640,height=480 ! appsink name=sink");
AppSink sink = (AppSink) pipeline.getElementByName("sink");
GstVideoComponent vc = new GstVideoComponent(sink);



--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gstreamer-java/CAPxOS5G9G4NsL8cxsmrjnKa%3D5bhm63yzf%3Du06%3D-9k1rrD%3DkZWw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages