-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Android VideoCapture get() properties on videofile are always 0 #22198
Copy link
Copy link
Closed
Description
System information (version)
- OpenCV => 4.6.0
- Operating System / Platform => Android (64 Bit)
Detailed description
I saw some topics about https://forum.opencv.org but there was not answer on it.
I opened a video file and I tried to get the props: CAP_PROP_FPS, CAP_PROP_FRAME_WIDTH, CAP_PROP_FRAME_HEIGHT and CAP_PROP_FRAME_COUNT. All of them returns 0.
NOTE: The video is opened and I can read the frames one by one.
I checked the source code and for android NDK backend at least the frame width and height looks like they are implemented.
Steps to reproduce
This is a code for the test application
if (cap.isOpened) {
details += "isOpen: true\n"
details += "Backend name: ${cap.backendName ?: ""}\n"
details += "FPS: ${cap.get(CAP_PROP_FPS)}\n"
details += "Frame width: ${cap.get(CAP_PROP_FRAME_WIDTH)}\n"
details += "Frame height: ${cap.get(CAP_PROP_FRAME_HEIGHT)}\n"
details += "Frame count: ${cap.get(CAP_PROP_FRAME_COUNT)}\n"
val frame = Mat()
var frameCounter = 0
while (cap.read(frame)) frameCounter++
details += "Read frame counted: ${frameCounter}\n"
} else {
details += "isOpen: false"
}
The test complete source code is here: https://github.com/danopdev/OpenCVVideoCaptureTest
This is the screenshot of the result:

The test video is here: https://github.com/danopdev/OpenCVVideoCaptureTest/blob/master/sample/20220621_082109.mp4
(a little more than 10MB so I can't attach it)
Issue submission checklist
- [ x ] I report the issue, it's not a question
- [ x ] I checked the problem with documentation, FAQ, open issues,
forum.opencv.org, Stack Overflow, etc and have not found any solution - [ x ] I updated to the latest OpenCV version and the issue is still there
- [ x ] There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable