Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open / write video file / stream on Linux #55

Closed
kasius75 opened this issue May 3, 2020 · 13 comments
Closed

Unable to open / write video file / stream on Linux #55

kasius75 opened this issue May 3, 2020 · 13 comments

Comments

@kasius75
Copy link

kasius75 commented May 3, 2020

The Linux lib is not built using video framework when looking at the cmake.log, resulting no video can be used:

--   Video I/O:
--     DC1394:                      NO
--     GStreamer:                   NO
--     v4l/v4l2:                    YES (linux/videodev2.h)

You should build with ffmpeg, gstreamer and DC1394 support (like this on Ubuntu 18.04):

--   Video I/O:
--     DC1394:                      YES (2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                YES (3.7.0)
--     GStreamer:                   YES (1.14.5)
--     v4l/v4l2:                    YES (linux/videodev2.h)
@vonnieda
Copy link
Member

vonnieda commented May 3, 2020

See comments in openpnp/openpnp#774. ffmpeg is not included for legal reasons, and because I haven't found a way to statically link it. You can install it manually and it should work.

@kasius75
Copy link
Author

kasius75 commented May 3, 2020

FFmpeg is already installed on my system and it does not work. I had to rebuild opencv to be able to use videos with it. I understand the license issue, but at this state, the linux version is almost useless without video support. Maybe you have to warn about it.

@wfaithfull
Copy link

👍 I also just discovered this today while trying to port an old OpenCV project to use this. This kills the usefulness of this library because the application revolves around VideoCapture, and without FFMPEG support it can't open anything. I already have FFMPEG installed, of course

@Jotschi
Copy link

Jotschi commented Jul 18, 2020

I think I also ran into the same problem.

The open method always returns false for me.

VideoCapture capture = new VideoCapture();
capture.open(path);

I'm using this version on debian linux (x86_64)

<dependency>
	<groupId>org.openpnp</groupId>
	<artifactId>opencv</artifactId>
	<version>4.3.0-2</version>
</dependency>

@Jotschi
Copy link

Jotschi commented Jul 18, 2020

Short update:

I was able to solve my issue by using the lib from the libopencv4.2-jni debian package.

I load the lib via System.loadLibrary("opencv_java420"); and added -Djava.library.path=/usr/lib/jni/ to my start parameters.

@vonnieda I'm not sure why you did not compile with video support but I think it would be enough to add a hint / note / warning to the readme that informs about this?

@enwi
Copy link

enwi commented Aug 13, 2020

I am having the same issue on windows. Is it also not included there?

@peterkronenberg
Copy link

I have also not yet been able to find a way to get this to work. Tried -Djava.library.path and -Djna.library.path, but neither seems to work

@deanbrok
Copy link

@Jotschi Hi, thank you for sharing your answer, however, are you still using this Maven package in addition to libopencv4.2-jni ? Or did you have to remove the Maven package first and then add libopencv4.2-jni?

@Jotschi
Copy link

Jotschi commented May 13, 2021

@deanbrok I have not changed my setup and it works with /usr/lib/jni and debian package opencv4.2-jni (4.2.0+dfsg-6+b4).

@deanbrok
Copy link

@Jotschi Thanks for such a quick reply! So you are no longer using Openpnp's Maven package? And I'm planning to deploy the app on a Docker image, I imagine your solution would work fine there too?

@Jotschi
Copy link

Jotschi commented May 13, 2021

@deanbrok I'm still using

<dependency>
	<groupId>org.openpnp</groupId>
	<artifactId>opencv</artifactId>
	<version>4.3.0-2</version>
</dependency>

If you provide the same libopencv4.2-jni package in your container image it should work. I'm not aware of any other working solution.

@deanbrok
Copy link

deanbrok commented May 14, 2021

@Jotschi Thank you for the help! I will try out your solution.

@vonnieda
Copy link
Member

Closing as a duplicate of #74. Please assist with that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants