You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
I started using mexopencv 2 days ago. Congratulations and thank you for your work. The problem I have is that when a read a video it reads 2 frames less than normal video length. I tested it with both MATLAB VideoFileReader (normal length) and mexopencv (2 frames less).
The code I use is
cap = cv.VideoCapture(video_path);
for i=1:cap.get('FrameCount')
img = cap.read();
if isempty(img), break; end
imshow(img)
drawnow
disp(i);
end
e.g. A video with 1446 frames goes until 1444 frames.
thanks
The text was updated successfully, but these errors were encountered:
NumberOfFrames will be removed in a future release.
Some files store video at a variable frame rate, including many Windows Media Video files.
For these files, VideoReader cannot determine the number of frames until you read the
last frame.
To count the number of frames in a variable frame rate file,
use the read method to read the last frame of the file.
Which is why both VideoReader and vision.VideoFileReader suggest iterating over frames one-by-one, instead of querying the count at the beginning...
The same thing applies to OpenCV, the FrameCount property is sometimes off, and the only way to exactly determine the number of frames is to read all the video frames:
vid =cv.VideoCapture('video.mp4');
i =0;
whiletrue
frame =vid.read();
if isempty(frame), break; end
i =i+1;
end
display(i)
Also I wouldn't exclude the possibility of a bug in OpenCV (or one of the underlying video drivers it uses). There are a coupleofreports online regarding this...
If that's the case, we can't do much about it in mexopencv, and it should be reported upstream.
I started using mexopencv 2 days ago. Congratulations and thank you for your work. The problem I have is that when a read a video it reads 2 frames less than normal video length. I tested it with both MATLAB VideoFileReader (normal length) and mexopencv (2 frames less).
The code I use is
e.g. A video with 1446 frames goes until 1444 frames.
thanks
The text was updated successfully, but these errors were encountered: