No such Gstreamer factory: appsink

641 views
Skip to first unread message

MvH

unread,
Nov 16, 2017, 6:07:50 AM11/16/17
to gstreamer-java
Hi,

I'm gstream beginner and I'm attempting to use gstreamer-java but I'm running into a:

0: java.lang.IllegalArgumentException: No such Gstreamer factory: appsink
1: at org.freedesktop.gstreamer.ElementFactory.makeRawElement(ElementFactory.java:221)
2: at org.freedesktop.gstreamer.Element.makeRawElement(Element.java:85)
3: at org.freedesktop.gstreamer.elements.AppSink.<init>(AppSink.java:49)

This comes from just calling:

AppSink videosink = new AppSink("GstVideoComponent");

I'm on Windows 10 and I've put the following as jvm argument:

-Djna.library.path=C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0 -Djna.debug_load=true

On startup (Gst.init()) I get this, but no errors:

Looking in classpath from sun.misc.Launcher$AppClassLoader@18b4aac2 for /com/sun/jna/win32-x86-64/jnidispatch.dll
Found library resource at jar:file:/C:/Users/xxx.yyyy/.m2/repository/net/java/dev/jna/jna/4.5.0/jna-4.5.0.jar!/com/sun/jna/win32-x86-64/jnidispatch.dll
Looking for library 'gstreamer-1.0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying gstreamer-1.0.dll
Adding system paths: []
Trying gstreamer-1.0.dll
Looking for lib- prefix
Trying C:\gstreamer\1.0\x86_64\bin\libgstreamer-1.0.dll
Found library 'gstreamer-1.0' at C:\gstreamer\1.0\x86_64\bin\libgstreamer-1.0.dll
Looking for library 'glib-2.0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying glib-2.0.dll
Adding system paths: []
Trying glib-2.0.dll
Looking for lib- prefix
Trying libglib-2.0.dll
Looking in classpath from sun.misc.Launcher$AppClassLoader@18b4aac2 for glib-2.0
Looking for library 'libglib-2.0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying libglib-2.0.dll
Adding system paths: []
Trying libglib-2.0.dll
Looking for lib- prefix
Trying liblibglib-2.0.dll
Looking in classpath from sun.misc.Launcher$AppClassLoader@18b4aac2 for libglib-2.0
Looking for library 'libglib-2.0-0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying C:\gstreamer\1.0\x86_64\bin\libglib-2.0-0.dll
Found library 'libglib-2.0-0' at C:\gstreamer\1.0\x86_64\bin\libglib-2.0-0.dll
Looking for library 'gobject-2.0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying gobject-2.0.dll
Adding system paths: []
Trying gobject-2.0.dll
Looking for lib- prefix
Trying libgobject-2.0.dll
Looking in classpath from sun.misc.Launcher$AppClassLoader@18b4aac2 for gobject-2.0
Looking for library 'libgobject-2.0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying libgobject-2.0.dll
Adding system paths: []
Trying libgobject-2.0.dll
Looking for lib- prefix
Trying liblibgobject-2.0.dll
Looking in classpath from sun.misc.Launcher$AppClassLoader@18b4aac2 for libgobject-2.0
Looking for library 'libgobject-2.0-0'
Adding paths from jna.library.path: C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
Trying C:\gstreamer\1.0\x86_64\bin\libgobject-2.0-0.dll
Found library 'libgobject-2.0-0' at C:\gstreamer\1.0\x86_64\bin\libgobject-2.0-0.dll

This is basically what I'd like to do (except get the video into a javafx window):

gst-launch-1.0.exe -v udpsrc port=16999 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)VP8" ! rtpvp8depay ! vp8dec ! autovideosink

Thanks, any help is appreciated!

MvH

unread,
Nov 16, 2017, 6:15:01 AM11/16/17
to gstreamer-java
And using gstreamer-1.0-x86_64-1.12.3 with gst1-java-core 0.9.1

Neil C Smith

unread,
Nov 16, 2017, 6:17:29 AM11/16/17
to gstream...@googlegroups.com
Hi,

On Thu, Nov 16, 2017 at 12:07 PM MvH <martti.v...@gmail.com> wrote:

I'm on Windows 10 and I've put the following as jvm argument:

-Djna.library.path=C:\gstreamer\1.0\x86_64\bin;C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0 -Djna.debug_load=true


This is expected behaviour, but unintuitive - we need to improve the docs! :-)

You can't just use jna.library.path - this will allow loading of the GStreamer core, but doesn't allow the core to find any of the plugins.

There are a number of options -

* Add the GStreamer bin directory to the system PATH env variable - OK for development but not great for shipping!  Probably the easiest way to get started.
* Use the JNA Platform library to initialise the PATH env variable just for the current process - see this code in Praxis LIVE https://github.com/praxis-live/praxis/blob/master/praxis.video.gst1/src/net/neilcsmith/praxis/video/gst1/components/GStreamerLibrary.java#L50
* Use (if I recall correctly) Registry.get().scanPaths(String path) with the jna.library.path setup as above, passing the path of the plugin folder(s).

Hope that helps.

Best wishes,

Neil
--
Neil C Smith
Artist & Technologist

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org

Phong Tran

unread,
Aug 21, 2020, 1:58:53 AM8/21/20
to gstreamer-java
Dear Neil,

I have same proplem above.

I try Add the GStreamer bin directory to the system PATH env variable. It work but have problem with shipping.

Second option is not available now.

So I try with third option but the problem is still there. Below is my code.
<code>
        Registry.get().scanPath("C:\\gstreamer\\1.0\\x86_64\\bin;C:\\gstreamer\\1.0\\x86_64\\lib\\gstreamer-1.0");
        Gst.init();
</code>

Thanks, any help is appreciated!  


Vào lúc 18:17:29 UTC+7 ngày Thứ Năm, 16 tháng 11, 2017, Neil C Smith đã viết:

Phong Tran

unread,
Aug 21, 2020, 5:43:48 AM8/21/20
to gstreamer-java
Dear Neil,

For your information.
I use 
JNA 5.6.0
gstreamer-1.0-x86_64-1.16.2 with 
gst1-java-core 1.2.0  
Javafx 14.
Windows 10 64 bit

Thanks you so much. 

Vào lúc 12:58:53 UTC+7 ngày Thứ Sáu, 21 tháng 8, 2020, Phong Tran đã viết:

Neil C Smith

unread,
Aug 21, 2020, 7:28:56 AM8/21/20
to gstream...@googlegroups.com
On Fri, 21 Aug 2020 at 06:58, Phong Tran <baoph...@gmail.com> wrote:
>
> Dear Neil,
>
> I have same proplem above.
>
> I try Add the GStreamer bin directory to the system PATH env variable. It work but have problem with shipping.
>
> Second option is not available now.

Why not?! Setting up the PATH (and other environment variables if
required) for or in your application is the way to deal with this.
JNA Platform isn't necessarily the only or right way to do this,
depending on what you're building and how you're shipping. But I can
only give generic advice, not application-specific packaging support,
via free support channels.

There is a range of documentation upstream on deploying an application
with GStreamer - using Java doesn't really change the options -
https://gstreamer.freedesktop.org/documentation/deploying/index.html?gi-language=c

> So I try with third option but the problem is still there. Below is my code.
> <code>
> Registry.get().scanPath("C:\\gstreamer\\1.0\\x86_64\\bin;C:\\gstreamer\\1.0\\x86_64\\lib\\gstreamer-1.0");
> Gst.init();
> </code>

This is a hack, and might work in some scenarios - it will probably
fail if plugins have dependencies. I haven't looked at anything like
this for a while - the order looks wrong along with the path you're
using.

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
Reply all
Reply to author
Forward
0 new messages