Skip to content

Commit fdf0c2b

Browse files
committed
Fix video frames count
1 parent 82f3fa2 commit fdf0c2b

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

superannotate/db/projects.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,14 @@ def _get_video_frames_count(video_path):
210210
Get video frames count
211211
"""
212212
video = cv2.VideoCapture(str(video_path), cv2.CAP_FFMPEG)
213-
total_num_of_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
214-
if total_num_of_frames < 0:
215-
total_num_of_frames = 0
216-
flag = True
217-
while flag:
218-
flag, _ = video.read()
219-
if flag:
220-
total_num_of_frames += 1
221-
else:
222-
break
213+
total_num_of_frames = 0
214+
flag = True
215+
while flag:
216+
flag, _ = video.read()
217+
if flag:
218+
total_num_of_frames += 1
219+
else:
220+
break
223221
return total_num_of_frames
224222

225223

0 commit comments

Comments
 (0)