Count the actual decodable frame count of an mp4 (PyAV demux).
(path: str)
| 274 | |
| 275 | |
| 276 | def _count_video_frames(path: str) -> int: |
| 277 | """Count the actual decodable frame count of an mp4 (PyAV demux).""" |
| 278 | c = av.open(path) |
| 279 | try: |
| 280 | s = next(x for x in c.streams if x.type == "video") |
| 281 | n = sum(1 for _ in c.decode(s)) |
| 282 | finally: |
| 283 | c.close() |
| 284 | return n |
| 285 | |
| 286 | |
| 287 | def _save_video(frames_rgb: List[np.ndarray], out_path: str, fps: float): |
no test coverage detected