Swing component to render gstreamer screen packets in udp protocol.

43 views
Skip to first unread message

ahmadreza soltani

unread,
Oct 30, 2022, 12:22:09 PM10/30/22
to gstreamer-java
Hi 
Packet stream of a PC screen receive to my ip with the bellow command :

gst-launch-1.0 -v gdiscreencapsrc  ! queue  ! videoconvert !  video/x-raw,format=I420 ! jpegenc ! rtpjpegpay ! queue ! udpsink host=(ip address of the PC you are streaming to) port=5000

Now, I need add a swing component to add main frame that read streamed packets in udp protocol and render the shared screen in my java application 
How can i do it?

Neil C Smith

unread,
Oct 30, 2022, 12:30:26 PM10/30/22
to gstream...@googlegroups.com
Hi,

Firstly work out what pipeline you need to decode that stream on the
client side to video/x-raw.

The, adapt the example at
https://github.com/gstreamer-java/gst1-java-examples/tree/master/SwingCamera

However, don't use the Bin as shown there as it might cause you problems.

Add "! appsink name=sink" to the end of the full pipeline and use

pipeline = (Pipeline) Gst.parseLaunch(<DESC>);
AppSink appsink = (AppSink) pipeline.getElementByName("sink");
GstVideoComponent vc = new GstVideoComponent(appsink);

Best wishes,

Neil
> --
> 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/60e7bc96-887b-4d6b-a703-6e1fa2590306n%40googlegroups.com.



--
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

ahmadreza soltani

unread,
Jan 25, 2023, 2:03:15 AM1/25/23
to gstream...@googlegroups.com
Hi
This lines is my code. It's work correctly. But I want to use autovideosink in my code. how can i do it requirement?

->
GsreamerUtils.configurePaths();
System.setProperty("sun.awt.xembedserver", "true");
Gst.init();

Pipeline pipeline =(Pipeline) Gst.parseLaunch("udpsrc port=5000 ! application/x-rtp, encoding-name=JPEG,payload=26 ! rtpjitterbuffer ! rtpjpegdepay ! jpegparse ! jpegdec ! appsink name=sink");
           
AppSink sink = (AppSink) pipeline.getElementByName("sink");
GstVideoComponent vc = new GstVideoComponent(sink);
pipeline.play();
<-

Reply all
Reply to author
Forward
0 new messages