Vidsz: Video's Wizard
Common Wrapper/Interface around various video reading/writing tools to make video reading stable, consistent and super easy around different systems and OS.
pip install vidsz
Backends
- OpenCV (in-development)
Features
- Easy and hassle free (read/write with
for-loop,with-block,while-loop) - Batch Support. Read and write frames in batches.
Read Video
Read with for-loop
from vidsz.opencv import Reader
# open reader
reader = Reader("static/countdown.mp4")
# read frame with for loop
for frame in reader:
# use ndarry-frame however you like
pass
# release
reader.release()
Read with a with-block
with Reader("static/countdown.mp4") as reader:
frame = reader.read()
Read with a while-loop
# this follows similar behavior as opencv counterpart
while reader.is_open():
# returns ndarry-frame or None if nothing left to read
frame = reader.read()
if frame is None:
break
Read frames in a batch
with Reader("dummy.mp4", batch_size=8, dynamic_batch=True) as reader:
batch_frames = reader.read()
Get properties of the reader
# print info: width, height, fps etc.
print(reader)
# access specific things
print(reader.width, reader.height, reader.fps)
# access number-of-frames/seconds/minutes that have been read
print(reader.frame_count, reader.seconds, reader.minutes)
Write Video
Write a single frame
from vidsz.opencv import Reader, Writer
video_fname = "static/countdown.mp4"
# open reader
reader = Reader(video_fname)
# start writer with the Reader object
# by default it'll append _out in the name of the output video
writer = Writer(reader)
# start writer with your settings;
# you can also give any combinations of
# following settings with Reader object to
# overwrite default settings
writer = Writer(name="out.mp4", width=1920, height=1080, fps=15)
# print writer info
print(writer)
# write single frame
frame = reader.read()
writer.write(frame)
Write with for-loop
# read frame with for loop
for frame in reader:
# write the ndarry-frame
writer.write(frame)
Write a batch
# read batches and write
with Reader("dummy.mp4", batch_size=8, dynamic_batch=True) as reader:
batch_frames = reader.read()
# write list or ndarray of frames
writer.write_all(batch_frames)
# close off
reader.release()
writer.release()
Write with a with-block
# using "with" block, write "static/countdown_out.mp4" (clone of input)
with Reader(video_fname) as reader:
with Writer(reader, name="out_with.mp4") as writer:
writer.write_all(reader)
Logo-Attribution Designed by brgfx / Freepik
Metadata
Release files for vidsz 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vidsz-0.2.0.tar.gz | 9.5 kB | Without provenance | Details for vidsz-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vidsz-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for vidsz-0.2.0-py3-none-any.whl |
Total release size: 25.0 kB
Release files / vidsz-0.2.0.tar.gz
| Download URL | vidsz-0.2.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
736f657de6d031c63a6cca1a411b63005b4f02c0988703090502918f181ff974
|
|
BLAKE2b-256 checksum How to use checksums |
47deb6525e4ff23a54fac587a14cb60fd5678da545e5a3adf6e3dc32517ed56c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10
|
Release files / vidsz-0.2.0-py3-none-any.whl
| Download URL | vidsz-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ee4069bf2d4f32bfc5e34f359329d3dc7f1391c55fe85427bef997a11281504
|
|
BLAKE2b-256 checksum How to use checksums |
33a55052d229db8612b65f3aa94f9df94550a182bfaea14d582157c7347feb86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10
|
Security for vidsz 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.