Hardware acceleration honoured by Vlc player but ignored by vlcj

Viewed 47

I'm writing some code to play media, I noticed that vlc mediaplayer correctly honours the --avcodec-hw parameter, but vlcj, with the same parameter passed to the library

This is how I build the mediaplayer component

//This uses jfx17

MediaPlayerFactory factory;
EmbeddedMediaPlayer mediaPlayer;
factory = new MediaPlayerFactory();
mediaPlayer = factory.mediaPlayers().newEmbeddedMediaPlayer();

var vs = new ImageViewVideoSurface(this.videoImageView);
mediaPlayer.videoSurface().set(vs);
videoImageView.setPreserveRatio(true);

String murl = "/tmp/mytestvideo.mp4";


mediaPlayer.media().play(murl, "--network-caching=100", 
                               "--avcodec-hw=vdpau_avcodec");
mediaPlayer.controls().start();

In vlc I set the vdpau trough the GUI menu (tools->preferences->Input/codecs)

the command nvidia-smi dmon shows few percentage when using vlc (and top gives really low cpu usage) but 0 when using the javaFx applcation (and top gives a 30% cpu usage).

How can I force the GPU video decoding?

EDIT:
Here are the versions of the software I'm using:
Ubuntu 20.04
vlc media player: 3.0.9.2
vlcj: 4.7.3
vlcj-natives: 4.7.0
vlcj-javafx: 1.1.0

0 Answers
Related