Skip to main content

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 PyPI

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.

Release files for cv-videowriter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cv-videowriter 0.1.0
File Size Uploaded
cv_videowriter-0.1.0.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cv-videowriter 0.1.0
File Interpreter ABI Platform
cv_videowriter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / cv_videowriter-0.1.0.tar.gz

Download URL cv_videowriter-0.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b1506a6c8eec4e21ecd32b8b5af601600fe3be10af2b2ccf8e7fb38a8bd1d709
BLAKE2b-256 checksum
How to use checksums
394a5694edb0d61aebe51a3eb7fbc346393ded7dec2a805f5699d81b5078c1f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.8

Release files / cv_videowriter-0.1.0-py3-none-any.whl

Download URL cv_videowriter-0.1.0-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0007e47afa2e0b0c4363621716a741e64fc4c369fde7725b3ad38808e4a315f
BLAKE2b-256 checksum
How to use checksums
150f8575e2f915986b6ac620f1f96409ba1fddc4a92a0effc8896d3e7665447f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page