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?
Chidiebere Brendan Obiechefu
Chidiebere Brendan Obiechefu 2021년 5월 18일
편집: Chidiebere Brendan Obiechefu 2021년 5월 18일
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.
Steven Lord
Steven Lord 2021년 5월 18일
Just because you're skipping over the frames doesn't mean the file has fewer frames.

댓글을 달려면 로그인하십시오.

 채택된 답변

Steven Lord
Steven Lord 2021년 5월 18일

0 개 추천

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