From a time in a video, can you get the frame number?

9 views (last 30 days)
I want to know what frame number we have from a video at certain time stamps. For example from 1:42 to 1:45 mark. How do I obtain this?
  2 Comments
Mathieu NOE
Mathieu NOE on 1 Apr 2025
hello
I suppose that you know the total number of frames and the start / end time stamps
then it's just a matter of linear interpolation
Walter Roberson
Walter Roberson on 1 Apr 2025
Knowing the total number of frames and the total video length and the start and end time stamps... assumes constant video frame timing.
If you do assume constant frame rate, then converting timestamp to frame number becomes possible by using the FrameRate property. However, if the frame rate is nominally 30 frames per second then the true frame rate might only be 29.97 frames per second, and it is questionable as to whether the header video frame rate will be 30/1 or 2997/100 or 30000/1001

Sign in to comment.

Answers (1)

SACHIN KHANDELWAL
SACHIN KHANDELWAL on 23 Apr 2025
Assuming that you want to get the number of frames in a video file using MATLAB, the following MATLAB Answers posts might be helpful for you:
Also, check out the official documentation for: https://www.mathworks.com/help/matlab/ref/videoreader.html
If this does not resolve the issue, could you please include your files and a more detailed problem statement? This will help in providing a more specific solution.

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!