MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / _count_video_frames

Function _count_video_frames

tools/preprocess/ltx2.3_preprocess_data.py:276–284  ·  view source on GitHub ↗

Count the actual decodable frame count of an mp4 (PyAV demux).

(path: str)

Source from the content-addressed store, hash-verified

274
275
276def _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
287def _save_video(frames_rgb: List[np.ndarray], out_path: str, fps: float):

Callers 2

_save_videoFunction · 0.85
process_input_videoFunction · 0.85

Calls 3

openMethod · 0.80
decodeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected