Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select video interface #3

Open
sfmig opened this issue Nov 28, 2024 · 2 comments
Open

Select video interface #3

sfmig opened this issue Nov 28, 2024 · 2 comments

Comments

@sfmig
Copy link
Contributor

sfmig commented Nov 28, 2024

  • @niksirbi has used sleap_io:
    • it has an excellent interface for lazy-loading videos into Python, which makes them available for indexing with numpy-style syntax.
    • It support multiple video backends ( supports reading through FFMPEG (the default), pyav, or OpenCV) and it works very well. It was a great help for this animation (each animation iteration just loads the corresponding video frame in memory, without having to load the entire video, or to extract the frames as images beforehands).

Other options:

  • pyvideoreader by Jan Clemens, used in his napari-video plugin.
    • from a quick look it seems like a lightweight/simpler alternative to sleap_io, being "a numpy-like interface, using opencv as a backend".
    • Opencv has issues with seeking, the napari-video devs are open to adding or replacing the opencv backend with pyav (see discussion here)
@niksirbi
Copy link
Member

There's also FastVideoReader - a class within the napari-pyav plugin that is mentioned in the discussion linked above. It uses pyav as a backend, and is reportedly, well, fast.

That said, for ethology I think sleap_io would make the most sense, because of the multiple backend support, and similar use-case to SLEAP (i.e. need to extract frames for labelling etc.). The other two solutions are more designed for video playback in napari.

@sfmig
Copy link
Contributor Author

sfmig commented Nov 28, 2024

torchcodec allows for videos to be decoded as PyTorch tensors, on CPU and CUDA GPU. It has nice sampling functionalities. It's in early development stages.

It's an evolution from torchvision's read_video, which is demoed in a nice tutorial applying RAFT to predict optic flow in a video.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants