(video_path)
| 104 | |
| 105 | |
| 106 | def read_frames(video_path): |
| 107 | container = av.open(video_path) |
| 108 | |
| 109 | video_stream = next(s for s in container.streams if s.type == "video") |
| 110 | frames = [] |
| 111 | for packet in container.demux(video_stream): |
| 112 | for frame in packet.decode(): |
| 113 | image = Image.frombytes( |
| 114 | "RGB", |
| 115 | (frame.width, frame.height), |
| 116 | frame.to_rgb().to_ndarray(), |
| 117 | ) |
| 118 | frames.append(image) |
| 119 | |
| 120 | return frames |
| 121 | |
| 122 | |
| 123 | def get_fps(video_path): |
no outgoing calls
no test coverage detected