Gstreamer-1.0 and JavaFX

560 views
Skip to first unread message

julien.s...@gmail.com

unread,
May 14, 2018, 2:12:06 PM5/14/18
to gstreamer-java
Hi, I used the JavaFX Media component to play .MP4 videos on Raspberry Pi 3B.
The problem is when I try to play HD or Full HD videos on it with JavaFX, the fps is really low (less than 2 per seconds).
I force the es2 accelerated video with -D parameter and it works, but with low framerate.

I guess the problem is because I play my video with JavaFX Media component wich play video through framebuffer.

How can I use gst-omx with Gstreamer-java1.0 to play h264 mp4 videos in JavaFX application ? And with good framerate (30 fps on 1920x1080p like omxplayer do).

Thanks for any help

Neil C Smith

unread,
May 14, 2018, 2:22:59 PM5/14/18
to gstream...@googlegroups.com
On Mon, 14 May 2018 at 19:12 <julien.s...@gmail.com> wrote:
I guess the problem is because I play my video with JavaFX Media component wich play video through framebuffer.

Are you using the built-in JavaFX media player or the component from https://github.com/gstreamer-java/gst1-javafx-examples ?  The former is nothing to do with us, and the latter might not perform that well on the Pi (or elsewhere) due to some shortcomings in JavaFX.

Do you need to have the video in a JavaFX UI?  If you can use a separate window, then a GStreamer autovideosink might work better.

I plan on looking at OpenGL texture sharing with Java at some point soon (unless anyone else already is?), but this unfortunately probably won't speed up JavaFX interop at the moment.

Best wishes,

Neil


--
Neil C Smith
Artist & Technologist

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

julien.s...@gmail.com

unread,
May 15, 2018, 3:57:14 AM5/15/18
to gstreamer-java
I'm using the JavaFX media player component but it's very slow.
I want to use the gst1-java to play video.
Yes I need to have the video in a JavaFX UI because I want to play video and show Image next to it.
Or maybe I'll use a separate window on top of the JavaFX UI ?

How can I add gst1 to play videos ? 

Thank you for your answer 

Neil C Smith

unread,
May 15, 2018, 4:57:22 AM5/15/18
to gstream...@googlegroups.com
Hi,

On Tue, 15 May 2018 at 08:57 <julien.s...@gmail.com> wrote:
I'm using the JavaFX media player component but it's very slow.
I want to use the gst1-java to play video.
Yes I need to have the video in a JavaFX UI because I want to play video and show Image next to it.
Or maybe I'll use a separate window on top of the JavaFX UI ?

How can I add gst1 to play videos ?

Maybe start with the gst1-java-examples repository and get those working.  Nothing specific to JavaFX in there, but should get you started with the API.

If you can't get the core JavaFX media player to work OK, I'm not sure you'll have any more luck with the bindings writing into a JavaFX component as the built-in components should have access to private faster methods.

Also, try using GStreamer from the command line - eg. gst-play-1.0 which should give you an idea of performance with GStreamer and native window.

Best wishes,

Neil

julien.s...@gmail.com

unread,
May 15, 2018, 5:00:51 AM5/15/18
to gstreamer-java
The native component of JavaFX work but I think it don't use the omx library to read video with hardware acceleration GPU (on Raspberry Pi). Omxplayer do the job pretty great and I want the same in JavaFX :)

You think gst binding will be worst than JavaFX media component ?

Ok I check that and post the return

Thank you

Neil C Smith

unread,
May 15, 2018, 5:10:53 AM5/15/18
to gstream...@googlegroups.com
On Tue, 15 May 2018 at 10:00 <julien.s...@gmail.com> wrote:
The native component of JavaFX work but I think it don't use the omx library to read video with hardware acceleration GPU (on Raspberry Pi). Omxplayer do the job pretty great and I want the same in JavaFX :)

You think gst binding will be worst than JavaFX media component ?

It depends!  If the bottleneck is getting the pixel data into JavaFX, then yes.  If the bottleneck is software decoding, then possibly the bindings will be better.

Also check the first answer here - https://stackoverflow.com/questions/34810424/gstreamer-dropping-frames-arm-processor  Found that with a little searching of omx and gstreamer.  It may be you need to specify specific plugins to get the hardware decoder to work.  Trying things on the command line before translating to Java is a good way to try things out.

I must get my Pi out soon and have a play myself!

Best wishes,

Neil

julien.s...@gmail.com

unread,
May 15, 2018, 5:14:59 AM5/15/18
to gstreamer-java
When I try the command : 

gst-launch-1.0 filesrc location="location of h264 video/file.avi" ! avidemux ! h264parse ! omxh264dec ! videoconvert ! ximagesink
It return :

WARNING : no omxh264dec element (translated from french)

when I grep omx from gst-inspect-1.0 it return only :

libav:  avenc_h264_omx: libav OpenMAX IL H.264 video encoder encoder

Neil C Smith

unread,
May 15, 2018, 6:08:45 AM5/15/18
to gstream...@googlegroups.com
Hi,

On Tue, 15 May 2018 at 10:15 <julien.s...@gmail.com> wrote:
When I try the command : 

gst-launch-1.0 filesrc location="location of h264 video/file.avi" ! avidemux ! h264parse ! omxh264dec ! videoconvert ! ximagesink
It return :

WARNING : no omxh264dec element (translated from french)
OK, you're going to have to do some searching then.  It may be that this element isn't installed, or that the functionality is now built in to something else.

I would also recommend asking on the upstream GStreamer devel mailing list - https://gstreamer.freedesktop.org/lists/

Best wishes,

Neil

Jim Carroll

unread,
May 15, 2018, 11:50:29 AM5/15/18
to gstream...@googlegroups.com
Just did a quick search because I was curious. It looks like it's an RPi specific plugin set. It's discussed here: https://gstreamer.freedesktop.org/releases/gst-omx/1.0.0.html

--
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-java+unsubscribe@googlegroups.com.
To post to this group, send email to gstreamer-java@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

julien.s...@gmail.com

unread,
May 16, 2018, 5:16:27 AM5/16/18
to gstreamer-java
Yes it's RPI specific because of the OpenMax IL 
I'll check that, I git clone and compile it and will try to use the same gst-launch-1.0 command like above

Thank you Jim :)

I get back here if I resolve the problem or not


Le mardi 15 mai 2018 17:50:29 UTC+2, Jim Carroll a écrit :
Just did a quick search because I was curious. It looks like it's an RPi specific plugin set. It's discussed here: https://gstreamer.freedesktop.org/releases/gst-omx/1.0.0.html
On Tue, May 15, 2018 at 6:08 AM, Neil C Smith <ne...@neilcsmith.net> wrote:
Hi,

On Tue, 15 May 2018 at 10:15 <julien.s...@gmail.com> wrote:
When I try the command : 

gst-launch-1.0 filesrc location="location of h264 video/file.avi" ! avidemux ! h264parse ! omxh264dec ! videoconvert ! ximagesink
It return :

WARNING : no omxh264dec element (translated from french)
OK, you're going to have to do some searching then.  It may be that this element isn't installed, or that the functionality is now built in to something else.

I would also recommend asking on the upstream GStreamer devel mailing list - https://gstreamer.freedesktop.org/lists/

Best wishes,

Neil
--
Neil C Smith
Artist & Technologist

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

--
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 post to this group, send email to gstream...@googlegroups.com.

Neil C Smith

unread,
May 16, 2018, 5:43:32 AM5/16/18
to gstream...@googlegroups.com
On Wed, 16 May 2018 at 10:16 <julien.s...@gmail.com> wrote:
Yes it's RPI specific because of the OpenMax IL 
I'll check that, I git clone and compile it and will try to use the same gst-launch-1.0 command like above

Thank you Jim :)

+1 :-)

I had assumed that plugin set was packaged for the Pi already?  Is it not?

Best wishes,

Neil

julien.s...@gmail.com

unread,
May 16, 2018, 5:48:22 AM5/16/18
to gstreamer-java
It seem not, I can't find it in gst-inspect. Maybe I'm using an old version, but yesterday I upgraded my RPI. I don't know why but I'm searching if I can install it

julien.s...@gmail.com

unread,
May 18, 2018, 4:49:38 AM5/18/18
to gstreamer-java
Ok, I just install epiphany-browser with 

sudo apt-get install epiphany-browser

and resolved the libEGL dependency problem with : 
sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so
$ sudo ln -fs /opt/vc/lib/libEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1
$ sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so
$ sudo ln -fs /opt/vc/lib/libGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2 

Now, I'm able to play video using gst-launch1.0 : 

gst-launch-1.0 filesrc num-buffers=100000 location=/root/file.mp4 ! qtdemux ! h264parse ! omxh264dec ! queue max-size-buffers=4 ! autovideosink -v

Now, how can I implement the gst-java in JavaFX to play my video in Pane ?

Thanks :) 
Reply all
Reply to author
Forward
0 new messages