I want to calculate the time duration of a avi file. I have tried to do using the elapsed time.vi. The output I am getting is around 0.04s but manually if I calculate it, the video file lasts around 7s. I am confused why it is showing the wrong value.
PS:I have attached my vi below
Solved! Go to Solution.
Try this, multiply the reciprocal of time between frames by totoal number of frames.
Untested, I have no codecs installed on this PC.
Thanks for the information. Now I can calculate the total time of an .avi file. For e.g if the video file stops at 13s in a media player,labVIEW displays the total time as 13.5 seconds. But, I guess LabVIEW shows the most accurate time
Can someone point out what's wrong with the 'read time between frames.vi '. The time calculated for all avi files are same .I guess it is because of the 'frame and data to examine' indicator where the slider shows 0-165 which is fixed and it is not varying with different videos. For e.g if time taken by video is of greater than 5.53s(shown on front panel),the video stops halfway on the front panel and if the time taken by video is lesser than 5.53s then the video starts playing again until the slider bar goes till 165.
Whats wrong with the VI? Isn'T 'frame and data to examine' shows the total number of frames in .avi file?
But,if I run the 'read AVI in labVIEW'.vi it is working fine i.e it shows different 'total time' for different videos.
Ok, to get accurate you probably want to reduce the number of frames by 2 since there's no delay before the first frame or after the last frame.
Eg. 10 frames with 0.2s between frames is 8*0.2 = 1.6s and not 2s.
I tried reducing the no of frames, but that doesnt' work.It only makes the total time taken as 5.4s(without reducing 2 frames,time=5.3s). The main Problem is not the total time ,but the wrong estimation of total number of frames. No matter which .avi file is played,it always displays 'total no of frames' to be 166 and 'Frames/sec' as 30. Therefore, the total time takes is always fixed (i.e 5.3s).
I can't find out why the total no of frames and frames/second values are constant. Any help will be highly appreciated.