number of frames in a video using VideoReader in r2015a

A = VideoReader('Augthirtycm.mp4');
n=A.NumFrames;
%Above is my simple code but when I run code it is showing error like below
No appropriate method, property, or field 'NumFrames' for class 'VideoReader'.
Error in frmaes (line 2)
n=A.NumFrames;
is there any alternative command for finding total number of frames in my video in r2015a version

 Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 9 Sep. 2020

4 Kommentare

Walter Roberson
Walter Roberson am 9 Sep. 2020
Bearbeitet: Walter Roberson am 9 Sep. 2020
Be sure to pay attention to the explanation in that description.
Both NumberOfFrames and the newer NumFrames have the same difficulty: they will seldom tell you the exact number of frames unless you have read the entire video. The explanation in the documentation talks about variable frame rate, but the same problem can happen on fixed frame rates.
You should never count on NumberOfFrames or NumFrames to be exactly right. If you need an exact frame count, read the entire video to the end in order to determine how many frames exactly were present.
Yes, the R2015a version of documentation mentions about this issue, but the newer NumFrames does not seem to have this problem. The getter method seems to go through all the frames automatically. If the video is large, then it blocks the execution until it can return a value.
Look down in the Limitations of the current documentation:
  • For some AVI, MOV, or MP4 files on Windows®, using the readFrame function to read all of the frames in the file can result in a different number of frames than the value returned by the NumFrames property of the VideoReader object.
The NumFrames count is not exact.
THONTI BEERAIAH
THONTI BEERAIAH am 9 Sep. 2020
Bearbeitet: THONTI BEERAIAH am 9 Sep. 2020
yes, 'NumberOfFrames' is showing exact number of frames thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by