Return the number of frames in a video file. Raises: RuntimeError: no frames found.
(self)
| 185 | return codecs |
| 186 | |
| 187 | def get_num_frames(self) -> int: |
| 188 | """ |
| 189 | Return the number of frames in a video file. |
| 190 | |
| 191 | Raises: |
| 192 | RuntimeError: no frames found. |
| 193 | """ |
| 194 | num_frames = int(self._get_cap().get(cv2.CAP_PROP_FRAME_COUNT)) |
| 195 | if num_frames == 0: |
| 196 | raise RuntimeError("0 frames found") |
| 197 | return num_frames |
| 198 | |
| 199 | def __len__(self): |
| 200 | return self.max_num_frames |