MCPcopy Create free account
hub / github.com/MeiGen-AI/InfiniteTalk / extract_specific_frames

Function extract_specific_frames

wan/utils/utils.py:140–152  ·  view source on GitHub ↗
(video_path, frame_id)

Source from the content-addressed store, hash-verified

138
139
140def extract_specific_frames(video_path, frame_id):
141 if is_video(video_path):
142 vr = VideoReader(video_path, ctx=cpu(0))
143 if frame_id < vr._num_frame:
144 frame = vr[frame_id].asnumpy() # RGB
145 else:
146 frame = vr[-1].asnumpy()
147 del vr
148 gc.collect()
149 frame = Image.fromarray(frame)
150 else:
151 frame = Image.open(video_path).convert("RGB")
152 return frame
153
154def get_video_codec(video_path):
155 result = subprocess.run(

Callers 1

generate_infinitetalkMethod · 0.90

Calls 1

is_videoFunction · 0.85

Tested by

no test coverage detected