Wrapper around OpenCV VideoWriter with some extra features
Project description
cv_videowriter
Wrapper around OpenCV VideoWriter with some extra features.
Features
- Raise an exception if the video file is not created due to wrong configuration parameters.
- Automatically select the video size based on the first written frame.
- Raise an exception if the passed frame has a different size than the video size.
- Add force resize option to resize the frame to a predefined size.
- It will run cvtColor if the frame color is not the same as the video color. Or it will raise an exception if the frame color is not convertible to the video color.
Installation 
pip install cv_videowriter
Usage
import cv2
import numpy as np
from cv_videowriter import VideoWriter
writer = VideoWriter('test.mp4', cv2.VideoWriter_fourcc(*'mp4v'), 30)
for i in range(10):
frame = np.random.randint(0, 255, (460, 640, 3), dtype=np.uint8)
writer.write(frame)
Parameters
filename: str - Path to the video file.fourcc: int - FourCC code of the codec used to compress the frames.fps: float (default: 30) - Frame rate of the created video.force_resize: tuple[int, int] (default: None) - Resize the frame to the specified size (height, width) before writing it to the video file.api_preference: int (default: cv2.CAP_ANY) - API backends for video capturing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cv_videowriter-0.1.0.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cv_videowriter-0.1.0.tar.gz.
File metadata
- Download URL: cv_videowriter-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1506a6c8eec4e21ecd32b8b5af601600fe3be10af2b2ccf8e7fb38a8bd1d709
|
|
| MD5 |
674f8971ed9abf32d4d5c3f8ce130e19
|
|
| BLAKE2b-256 |
394a5694edb0d61aebe51a3eb7fbc346393ded7dec2a805f5699d81b5078c1f8
|
File details
Details for the file cv_videowriter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cv_videowriter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0007e47afa2e0b0c4363621716a741e64fc4c369fde7725b3ad38808e4a315f
|
|
| MD5 |
0701d60be6c22a2e6445aa2c093128d5
|
|
| BLAKE2b-256 |
150f8575e2f915986b6ac620f1f96409ba1fddc4a92a0effc8896d3e7665447f
|