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 个评论

Chidiebere - since the number of frames are the same, does that mean the duration is the same too? For example, what is
duration = v.Duration;
for the full video and the full video less the four seconds?
Yeah it gives me same duration as well which I also don’t get. The video is 30fps so I expected to see numframes less by 120.
Just because you're skipping over the frames doesn't mean the file has fewer frames.

请先登录,再进行评论。

 采纳的回答

Steven Lord
Steven Lord 2021-5-18
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.

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by