MCPcopy Create free account
hub / github.com/Francis-Rings/MotionFollower / read_frames

Function read_frames

src/utils/util.py:120–134  ·  view source on GitHub ↗
(video_path)

Source from the content-addressed store, hash-verified

118 image.save(save_path)
119
120def read_frames(video_path):
121 container = av.open(video_path)
122
123 video_stream = next(s for s in container.streams if s.type == "video")
124 frames = []
125 for packet in container.demux(video_stream):
126 for frame in packet.decode():
127 image = Image.frombytes(
128 "RGB",
129 (frame.width, frame.height),
130 frame.to_rgb().to_ndarray(),
131 )
132 frames.append(image)
133
134 return frames
135
136
137def get_fps(video_path):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected