I am reading large AVI files and want to know the number of stored frames.
To do that in Mathematica 11.3 I use the following:
Needs["MediaTools`"]; numberImages = MediaTools`Private`$MFReadVideoFrameCount["movie.avi"];
This second line takes too much time (e.g. 205 sec for finding out that an AVI movie contains 4325 frames).
I am working with thousands of such and longer AVI files, and if I always have to wait for some minutes to find the total frame number it would sum up for thousand files to 3000 min = 50 hours!!! (In reality more.)
I there a possibility to read the value from the header?
For example VirtualDub (free Software for Windows) reads the information in a fraction of a second and the value is exact, not estimated! I tested this for hundreds of AVI files. My AVI files are experimental movie files where the correct number is written into the header.
After the comments of Buddha_the_Scientist and C. M. I would like to provide some additional information:
Here is an example avi movie (named "20181203_01_movie.avi", only 1 MB in size): https://drive.google.com/open?id=1Wmp0YGZtKTYxBd2nGzgyglJKrNb_Uk0_
numberImages = MediaTools
Private$MFReadVideoFrameCount[ "20181203_01_movie.avi"] // AbsoluteTiming
Second step with restarted kernel:
numberImages = Import["20181203_01_movie.avi", "FrameCount"] // AbsoluteTiming
So for this very small avi file it takes about 4 sec to read the total number of images (350).
Now lets take exiftool: I downloaded the Windows Version from here: https://www.sno.phy.queensu.ca/~phil/exiftool/
On Windows command shell cmd:
That gives instantaneously the total frame count of 350 and many other data from the header:
Question to the Mathematica experts:
How can I read the meta information WITH Mathematica? I cannot believe that I have to use an external program to do that.