I'm having trouble running the sample example. can you help me?

28 views
Skip to first unread message

김기훈

unread,
Nov 28, 2023, 10:34:15 AM11/28/23
to gstreamer-java
hi. I'm having trouble running the sample example.
example is BasicPipeline.java (https://github.com/gstreamer-java/gst1-java-examples/blob/master/BasicPipeline/src/main/java/org/freedesktop/gstreamer/examples/BasicPipeline.java)

In conclusion, the following error occurs when running the example.
"main" java.lang.UnsatisfiedLinkError: Could not load library: gstreamer

For your understanding, I will list my environment.
my gst version is 1.22.3
OS : Window11
maven dependency
<dependency>
<groupId>org.freedesktop.gstreamer</groupId>
<artifactId>gst1-java-core</artifactId>
<version>1.1.0</version>
</dependency>

gst bin PATH : C:\gstreamer\1.0\msvc_x86_64\bin (Registered as an environment variable)
framework : springboot
edit tool : intellij

I can run the pipeline  'gst-launch-1.0 [pipeline]'

I will wait for your answer :)



Neil C Smith

unread,
Nov 28, 2023, 10:41:48 AM11/28/23
to gstream...@googlegroups.com
The example is based on Gradle not Maven, and does not require setting
the PATH manually - it's built into the example. I cannot remember
for sure, but I think the path has to end with \ too.

The latest version of the bindings is 1.4.0. It included fixes for
running with the msvc version of GStreamer. 1.1.0 will probably only
work with the mingw version anyway.

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 : 3rd Floor Suite, 207 Regent Street,
London, W1B 3HH, England

Alan Hdez

unread,
Nov 28, 2023, 10:49:52 AM11/28/23
to gstreamer-java
Maybe you can check the documentation to install gstreamer, 

Regards,
Alan

김기훈

unread,
Dec 4, 2023, 5:01:57 AM12/4/23
to gstreamer-java
Thank you for reply.
My problem was solved by changing version! (1.1.0 > 1.4.0)

I have additional question..
I would like to transmit multiple files in order to the streaming server. And I want to leave an interval of 4 seconds between sound sources.

this is my source code
public static void main(String[] args) throws InterruptedException {
// GStreamer initialize
Gst.init(Version.BASELINE, "MultipleAudioFilesStreamer", args);
// file list
String[] filePaths = {"/Users/USER/Music/강우대피.mp3","/Users/USER/Music/ding-47489.mp3", "/Users/USER/Music/강우경계.mp3"};

for (int i = 0; i < filePaths.length; i++) {
String pipelineStr =
"filesrc location=" + filePaths[i] + " ! decodebin ! queue ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! udpsink host=127.0.0.1 port=8083";
Pipeline pipeline = (Pipeline) Gst.parseLaunch(pipelineStr);

// register EOS listener
Bus bus = pipeline.getBus();
bus.connect(new Bus.EOS() {
@Override
public void endOfStream(GstObject gstObject) {
System.
out.println("EOS!!");
EOS = true;
}
})
;

// excute pipeline
pipeline.play();
System.out.println("Play@!@!");
// Scanner sc = new Scanner(System.in);
// sc.next();
// waiting EOS event..
while (true) {
Thread.
sleep(1000);
System.out.println("wait" + pipeline.getState());
if (EOS) {
System.
out.println("eos status" + pipeline.getState());
Thread.sleep(4000);
break;
}
}

// stop pipeline
pipeline.stop();
pipeline.dispose();
EOS = false;
} //gst quit after 10 second
Gst.
getExecutor().schedule(Gst::quit, 10, TimeUnit.SECONDS);

}

This code works, but the sound is interrupted.

I think thread sleep is the problem. 
This is because the longer the sleep time, the longer the disconnection time. 
Can you please let me know if there is a better code or pipeline for streaming multi-files?

Thank you
2023년 11월 29일 수요일 오전 12시 49분 52초 UTC+9에 alanartur...@gmail.com님이 작성:

Neil C Smith

unread,
Dec 4, 2023, 5:08:00 AM12/4/23
to gstream...@googlegroups.com
Hi,

You would probably be better using a single PlayBin and setting the
audio sink to a Bin with the required encoder and udpsink.

If you cannot get that to work, then still reuse the pipeline and set
the filesrc property.

Don't use Thread.sleep. Don't block the GStreamer event threads. The
Gst::getExecutor is a scheduled executor service. Just schedule the
restart to happen at the required time from inside the Bus.EOS
handler.

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/4b7ce0c7-cabf-4b57-9a6e-ca993093972bn%40googlegroups.com.

김기훈

unread,
Dec 4, 2023, 7:48:29 AM12/4/23
to gstream...@googlegroups.com
Thanks to you, everything worked out fine.


2023년 12월 4일 (월) 오후 7:08, Neil C Smith <ne...@codelerity.com>님이 작성:
> To view this discussion on the web visit https://groups.google.com/d/msgid/gstreamer-java/CAPxOS5EtmbTaUpcYikqkSJSeoP1iO1ECNy53pMNxhthE9EX%2B%2BA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages