Skip to content

Commit a12a17e

Browse files
committed
fixed bug of early terminating seeking video when frame extraction fails
1 parent 52762c0 commit a12a17e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mmif/utils/video_document_helper.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ def extract_frames_as_images(video_document: Document, framenums: Iterable[int],
101101
if not ret:
102102
sec = convert(cur_f, 'f', 's', video_document.get_property(FPS_DOCPROP_KEY))
103103
warnings.warn(f'Frame #{cur_f} ({sec}s) could not be read from the video {video_document.id} @ {video_document.location} .')
104-
cur_f += 1
105-
continue
106-
frames.append(Image.fromarray(frame[:, :, ::-1]) if as_PIL else frame)
104+
else:
105+
frames.append(Image.fromarray(frame[:, :, ::-1]) if as_PIL else frame)
107106
next_target_f = next(framenumi, None)
108107
cur_f += 1
109108
ffmpeg_err_str = ffmpeg_errs.getvalue()

0 commit comments

Comments
 (0)