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

Can't initialize VIdeoCapture from file #551

Closed
111raigeki opened this issue Mar 14, 2024 · 3 comments
Closed

Can't initialize VIdeoCapture from file #551

111raigeki opened this issue Mar 14, 2024 · 3 comments

Comments

@111raigeki
Copy link

Hello, I am trying to open a video using VideoCapture::from_file, but I can't get it to read the file properly. The project builds without any issues, but is_opened doesn't return true:

let mut cam = videoio::VideoCapture::from_file("data/test_vid.mp4", videoio::CAP_ANY)?;

let opened = videoio::VideoCapture::is_opened(&cam)?;//always false independent of file path or file format 

I've tried to do the same in python (3.10, opencv-python 4.9.0) and it works just fine. Capturing video from webcam also works fine.

Information:

  1. os: Mint 21.2
  2. way to install opencv: manual build (cmake)
  3. opencv version: 4.9.0-dev
  4. rustc version: 1.76.0 (07dca489a 2024-02-04)
  5. crate version: 0.88.8
@twistedfall
Copy link
Owner

It can be that OpenCV is built without mp4 support for example, but python is using the different OpenCV version that has this support. Please also post cargo build -vv after doing cargo clean, it contains a lot of helpful debug information that might aid in tracking the source of the issue down.

@111raigeki
Copy link
Author

The codecs were indeed the issue - for some reason opencv did not recognize ffmpeg. Thank you for help.

@benjamingb
Copy link

benjamingb commented May 5, 2024

The codecs were indeed the issue - for some reason opencv did not recognize ffmpeg. Thank you for help.

@111raigeki
I have the same problem, what codecs did you need to install?

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

3 participants