Question

I was wondering why scikit-image returns the frame count of a video as a float. Is there ever an occasion when a video has a fractional number of frames?

This code snippet...

import skimage.io as io
v = io.Video('videos/intersection_cine.avi')
v.frame_count()

...returns 17313.0

Was it helpful?

Solution

skimage.io.Video works by using OpenCV, and for frame_count it uses OpenCV's function GetCaptureProperty which always returns a double no matter what property is passed.

This function, in turn, calls another function based on how/where the video capture was created. As an example, it could be based on GStreamer, which will always return an integer for frame_count. When using QuickTime instead, frame_count is defined as movieDuration*movieFPS/1000 and therefore is a floating-point value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top