VLC is unable to open th MRL when using vlcj in Java

308 views Asked by At

I'm trying to get the vljc-javafx-demo application running and I'm running in to the following problem:

[00007f9884007300] v4l2 demux error: cannot open device '/dev/video0 ': No such file or directory
[00007f9884007300] v4l2 demux error: cannot open device '/dev/video0 ': No such file or directory
[00007f9884007300] v4l2 demux error: cannot open device '/dev/video0 ': No such file or directory
[00007f9884007300] v4l2 demux error: cannot open device '/dev/video0 ': No such file or directory
[00007f9884013920] v4l2 stream error: cannot open device '/dev/video0 ': No such file or directory
[00007f9884013920] v4l2 stream error: cannot open device '/dev/video0 ': No such file or directory
[00007f989820af20] main input error: Your input can't be opened
[00007f989820af20] main input error: VLC is unable to open the MRL 'v4l2:///dev/video0 :v4l2-width=3840 :v4l2-height=2160'. Check the log for details.

When I issue the following from the command line it works perfectly:

vlc v4l2:///dev/video0 :v4l2-width=3840 :v4l2-height=2160

This is the minimum MRL that will work with this new capture device (Magewell Eco Capture HDMI 4K M2.2). I've been using FfmpegFrameGrabber and OpenCV libraries from Bytedeco but I'm hoping to improve performance with this library if I can get it to work.

As for 'Check the log for details', nothing is logged anywhere as far as I can tell. I set up VLC to log to file and to syslog and there's nothing generated by this demo application.

I did add my user to the video group even though the VLC command line worked without me being in the group, and that had no effect.

Running all this on Ubuntu 20.04, JavaSE 14/JavaFX 14.0.2.1, vlcj 4.7.0 vlcj-javafx 1.0.2, VLC 3.0.9.2, Eclipse 2020-06.

Thanks for any help!

1

There are 1 answers

1
caprica On BEST ANSWER

The MRL should be v4l2://.

Then you use media options or MediaPlayerFactory arguments:

String[] args = {
    "--v4l2-dev", "/dev/video0",
    "--v4l2-width", "3840",
    "--v4l2-height", "2160"
}

Either create the MediaPlayerFactory with those args, or pass them as media options when you use play().