# napari-video
[](https://napari-hub.org/plugins/napari_video)
Napari plugin for working with videos.
Relies on [pyvideoreader](https://pypi.org/project/pyvideoreader/) as a backend which itself uses [opencv](https://opencv.org) for reading videos.
## Installation
```shell
pip install napari[all] napari_video
```
## Usage
From a terminal:
```shell
napari video.avi
```
Or from within python:
```shell
import napari
from napari_video.napari_video import VideoReaderNP
path='video.mp4'
vr = VideoReaderNP(path)
with napari.gui_qt():
viewer = napari.view_image(vr, name=path)
```
## Internals
`napari_video.napari_video.VideoReaderNP` exposes a video with a numpy-like interface, using opencv as a backend.
For instance, open a video:
```python
vr = VideoReaderNP('video.avi')
print(vr)
```
```
video.avi with 60932 frames of size (920, 912, 3) at 100.00 fps
```
Then
- `vr[100]` will return the 100th frame as a numpy array with shape `(902, 912, 3)`.
- `vr[100:200:10]` will return 10 frames evenly spaced between frame number 100 and 200 (shape `(10, 902, 912, 3)`).
- Note that by default, single-frame and slice indexing return 3D and 4D arrays, respectively. To consistently return 4D arrays, open the video with `remove_leading_singleton=False`. `vr[100]` will then return a `(1, 902, 912, 3)` array.
- We can also request specific ROIs and channels. For instance, `vr[100:200:10,100:400,800:850,1]` will return an array with shape `(10, 300, 50, 1)`.
Raw data
{
"_id": null,
"home_page": "https://github.com/janclemenslab/napari-video",
"name": "napari_video",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Jan Clemens",
"author_email": "clemensjan@googlemail.com",
"download_url": "https://files.pythonhosted.org/packages/2b/08/9b21abdfb6bfee7d2efcf5525bf75e5f8a66c15179aa22e2bac6c0e6e312/napari_video-0.2.13.tar.gz",
"platform": null,
"description": "# napari-video\n[](https://napari-hub.org/plugins/napari_video)\n\nNapari plugin for working with videos.\n\nRelies on [pyvideoreader](https://pypi.org/project/pyvideoreader/) as a backend which itself uses [opencv](https://opencv.org) for reading videos.\n\n## Installation\n```shell\npip install napari[all] napari_video\n```\n\n## Usage\nFrom a terminal:\n```shell\nnapari video.avi\n```\n\nOr from within python:\n```shell\nimport napari\nfrom napari_video.napari_video import VideoReaderNP\n\npath='video.mp4'\nvr = VideoReaderNP(path)\nwith napari.gui_qt():\n viewer = napari.view_image(vr, name=path)\n```\n\n## Internals\n`napari_video.napari_video.VideoReaderNP` exposes a video with a numpy-like interface, using opencv as a backend.\n\nFor instance, open a video:\n```python\nvr = VideoReaderNP('video.avi')\nprint(vr)\n```\n```\nvideo.avi with 60932 frames of size (920, 912, 3) at 100.00 fps\n```\nThen\n\n- `vr[100]` will return the 100th frame as a numpy array with shape `(902, 912, 3)`.\n- `vr[100:200:10]` will return 10 frames evenly spaced between frame number 100 and 200 (shape `(10, 902, 912, 3)`).\n- Note that by default, single-frame and slice indexing return 3D and 4D arrays, respectively. To consistently return 4D arrays, open the video with `remove_leading_singleton=False`. `vr[100]` will then return a `(1, 902, 912, 3)` array.\n- We can also request specific ROIs and channels. For instance, `vr[100:200:10,100:400,800:850,1]` will return an array with shape `(10, 300, 50, 1)`.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "napari plugin for reading videos.",
"version": "0.2.13",
"project_urls": {
"Bug Tracker": "https://github.com/janclemenslab/napari-video/issues",
"Documentation": "https://github.com/janclemenslab/napari-video/blob/main/README.md",
"Homepage": "https://github.com/janclemenslab/napari-video",
"Source Code": "https://github.com/janclemenslab/napari-video",
"User Support": "https://github.com/janclemenslab/napari-video/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1dfd6de9f181a51467d9b68fb2bb7eab2bcaaeec305665496227b3595418f96c",
"md5": "c2b09972f9cf60b7c19871c0b01bf671",
"sha256": "ded8ffc1a5557ace61ae03b9695fdf1a7f2a055f09f844825eff921e57fcfc33"
},
"downloads": -1,
"filename": "napari_video-0.2.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c2b09972f9cf60b7c19871c0b01bf671",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4727,
"upload_time": "2025-08-20T09:13:28",
"upload_time_iso_8601": "2025-08-20T09:13:28.184384Z",
"url": "https://files.pythonhosted.org/packages/1d/fd/6de9f181a51467d9b68fb2bb7eab2bcaaeec305665496227b3595418f96c/napari_video-0.2.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2b089b21abdfb6bfee7d2efcf5525bf75e5f8a66c15179aa22e2bac6c0e6e312",
"md5": "a629863a30baf50b008161194d9ef62a",
"sha256": "0a81ea583d8562d5ed2226b323a77f7953a98aa1b2276213788352c18c16b29c"
},
"downloads": -1,
"filename": "napari_video-0.2.13.tar.gz",
"has_sig": false,
"md5_digest": "a629863a30baf50b008161194d9ef62a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5488,
"upload_time": "2025-08-20T09:13:29",
"upload_time_iso_8601": "2025-08-20T09:13:29.886483Z",
"url": "https://files.pythonhosted.org/packages/2b/08/9b21abdfb6bfee7d2efcf5525bf75e5f8a66c15179aa22e2bac6c0e6e312/napari_video-0.2.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 09:13:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "janclemenslab",
"github_project": "napari-video",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "napari_video"
}