问题描述
我正在尝试运行vljc-javafx-demo应用程序,但遇到了以下问题:
[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.
当我从命令行发出以下命令时,它运行正常:
vlc v4l2:///dev/video0 :v4l2-width=3840 :v4l2-height=2160
这是此新捕获设备(Magewell Eco Capture HDMI 4K M2.2)可使用的最低MRL。我一直在使用Bytedeco的FfmpegFrameGrabber和OpenCV库,但是我希望可以通过使用该库来提高性能。
至于“检查日志以了解详细信息”,据我所知,什么都没有记录。我将VLC设置为登录到文件和syslog,此演示应用程序未生成任何内容。
即使VLC命令行在我没有加入视频组的情况下也可以将我的用户添加到视频组中,但这没有任何作用。
在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。
感谢您的帮助!
解决方法
MRL应该为v4l2://
。
然后您使用媒体选项或MediaPlayerFactory参数:
String[] args = {
"--v4l2-dev","/dev/video0","--v4l2-width","3840","--v4l2-height","2160"
}
要么使用这些args创建MediaPlayerFactory,要么在使用play()时将它们作为媒体选项传递。