Name | pyvideoreader JSON |
Version |
0.5.7
JSON |
| download |
home_page | None |
Summary | Wrapper around opencv's cv2.VideoCapture to simplify reading video files in python. |
upload_time | 2024-10-13 07:34:44 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Pythonic video reader
Wrapper around [opencv's][1] `cv2.VideoCapture` to simplify reading video files in python.
## Installation
In a terminal window run:
```shell
conda install pyvideoreader -c ncb
```
or
```shell
pip install pyvideoreader
```
## Usage
Open a video file and read frame 100:
```python
from videoreader import VideoReader
vr = VideoReader(video_file_name)
print(vr) # prints video_file_name, number of frames, frame rate and frame size
frame = vr[100]
vr.close()
```
Or use a [context manger][2] which takes care of opening and closing the video:
```python
with VideoReader(video_file_name) as vr: # load the video
frame = vr[100]
```
Supports slice-syntax: `vr[start:end:step]`. To iterate over all frames you need to use `vr[:]`. To read every 100th frame, starting at frame 500 and ending at frame 10000 do this:
```python
for frame in vr[500:10000:100]:
do_something_with(frame)
```
Lists, tuples or ranges can also be passed as indices, e.g. `vr[(42, 314, 999)]`.
Note that indexing returns a generator - each frame in the indices is read on demand which saves memory. If you need all frames at once you can convert it to a list `list(vr[start:end:frame])`.
For compatibility, `videoreader` can also be used like the underlying `cv2.VideoCapture`:
```python
ret, frame = vr.read() # read next frame
```
[1]: http://opencv.org
[2]: https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/
Raw data
{
"_id": null,
"home_page": null,
"name": "pyvideoreader",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Jan Clemens <clemensjan@googlemail.com>",
"download_url": "https://files.pythonhosted.org/packages/47/7f/f92c33e37dad8594f4d05da2ce167b529709605df448bf2f75d1a7316dd7/pyvideoreader-0.5.7.tar.gz",
"platform": null,
"description": "# Pythonic video reader\nWrapper around [opencv's][1] `cv2.VideoCapture` to simplify reading video files in python.\n\n## Installation\nIn a terminal window run:\n```shell\nconda install pyvideoreader -c ncb\n```\nor\n```shell\npip install pyvideoreader\n```\n\n## Usage\nOpen a video file and read frame 100:\n```python\nfrom videoreader import VideoReader\nvr = VideoReader(video_file_name)\nprint(vr) # prints video_file_name, number of frames, frame rate and frame size\nframe = vr[100]\nvr.close()\n```\n\nOr use a [context manger][2] which takes care of opening and closing the video:\n```python\nwith VideoReader(video_file_name) as vr: # load the video\n frame = vr[100]\n```\n\nSupports slice-syntax: `vr[start:end:step]`. To iterate over all frames you need to use `vr[:]`. To read every 100th frame, starting at frame 500 and ending at frame 10000 do this:\n```python\nfor frame in vr[500:10000:100]:\n do_something_with(frame)\n```\nLists, tuples or ranges can also be passed as indices, e.g. `vr[(42, 314, 999)]`.\n\nNote that indexing returns a generator - each frame in the indices is read on demand which saves memory. If you need all frames at once you can convert it to a list `list(vr[start:end:frame])`.\n\nFor compatibility, `videoreader` can also be used like the underlying `cv2.VideoCapture`:\n```python\nret, frame = vr.read() # read next frame\n```\n\n[1]: http://opencv.org\n[2]: https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/\n",
"bugtrack_url": null,
"license": null,
"summary": "Wrapper around opencv's cv2.VideoCapture to simplify reading video files in python.",
"version": "0.5.7",
"project_urls": {
"Documentation": "https://github.com/postpop/videoreader",
"Source": "https://github.com/postpop/videoreader"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3c790ddc6c5d5a3b83c685a5cff9b53b9977007cc2604d7285e1e943f1638574",
"md5": "b31e7fd6ec0a9f3afb89fe5d805816da",
"sha256": "22111a5371d12d5a12529e04a5b840f1d1592bb8385227b1a0b1e86d4a4788a7"
},
"downloads": -1,
"filename": "pyvideoreader-0.5.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b31e7fd6ec0a9f3afb89fe5d805816da",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7186,
"upload_time": "2024-10-13T07:34:42",
"upload_time_iso_8601": "2024-10-13T07:34:42.467593Z",
"url": "https://files.pythonhosted.org/packages/3c/79/0ddc6c5d5a3b83c685a5cff9b53b9977007cc2604d7285e1e943f1638574/pyvideoreader-0.5.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "477ff92c33e37dad8594f4d05da2ce167b529709605df448bf2f75d1a7316dd7",
"md5": "b6cadba3ed84891067c83872527f864a",
"sha256": "f5fafb7760468863f08d2ee1c613a46bec5f2b0ca64af681eb313c66bb08cb47"
},
"downloads": -1,
"filename": "pyvideoreader-0.5.7.tar.gz",
"has_sig": false,
"md5_digest": "b6cadba3ed84891067c83872527f864a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9802,
"upload_time": "2024-10-13T07:34:44",
"upload_time_iso_8601": "2024-10-13T07:34:44.518662Z",
"url": "https://files.pythonhosted.org/packages/47/7f/f92c33e37dad8594f4d05da2ce167b529709605df448bf2f75d1a7316dd7/pyvideoreader-0.5.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-13 07:34:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "postpop",
"github_project": "videoreader",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyvideoreader"
}