Matlab ignores my videoReader command
2 views (last 30 days)
Show older comments
Chidiebere Brendan Obiechefu
on 18 May 2021
Commented: Chidiebere Brendan Obiechefu
on 21 May 2021
I am trying to read a video from 4 seconds in. I use this:
v = VideoReader('IMG_3557.MOV','CurrentTime',4); % read video file
But when I do ths:
numbframes = v.NumFrames;
I get the same number of frames as the entire video from the beginning. I'm not sure what I'm doing wrong. Thanks
3 Comments
Steven Lord
on 18 May 2021
Just because you're skipping over the frames doesn't mean the file has fewer frames.
Accepted Answer
Steven Lord
on 18 May 2021
Have you read the data from the VideoReader or have you just created the object?
If I open to page 23 of a 345 page long book but then ask how many pages the book has, I'll have to flip to the last page to get the answer 345.
If I ask the question how many pages do I still have to read, one way to do that is to read the pages one by one and count each page as I read it.
I think the "Read Video Using Frame Index and Time Interchangeably" example on the documentation page does something like what you're trying to do.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!