google / mediapy

This Python library makes it easy to display images and videos in a notebook.
https://pypi.org/project/mediapy/
Apache License 2.0
389 stars 18 forks source link

Large videos #5

Closed YoussefBarada96 closed 2 years ago

YoussefBarada96 commented 2 years ago

Hii, I would like to ask how can I open large videos (.avi format) using mediapy. The problem is when I try to open large video the system freezes for a while than it is closed with no errors. Hence I would like to know if mediapy doesn't support large files. Thanks in advance

hhoppe commented 2 years ago

Are you using read_video() as in https://google.github.io/mediapy/#mediapy.read_video to read the entire video into an array? Have you tried reading using VideoReader as in https://google.github.io/mediapy/#mediapy.VideoReader to instead read frame-by-frame?

YoussefBarada96 commented 2 years ago

I need to access the frames by index that's why I am using read_video() not VideoReader.

hhoppe commented 2 years ago

What is the access pattern?

PWhiddy commented 2 years ago

@YoussefBarada96 maybe you are running out of memory? A numpy array storing even just a 1 min video all in memory at once as 32-bit floats is 1920*1080*60*60*3*4 (WxHxFPSxSPMxCxBPC) bytes, or almost 90GB.

hhoppe commented 2 years ago

Closing this issue; the video was likely too large to load all-at-once into memory.