From c1650cec7ec59a10bfa1457bde863fd86e49ded2 Mon Sep 17 00:00:00 2001 From: Maik Riechert Date: Mon, 22 Mar 2021 22:20:39 +0000 Subject: [PATCH] prep for next release --- CHANGELOG.md | 3 ++- README.md | 4 ++-- pyvirtualcam/_version.py | 2 +- samples/video.py | 7 ++++++- samples/webcam_filter.py | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ebf2bf..2dc6f4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.6.0] - 2012-03-22 ### Added +- Support for device selection on Linux: `Camera(..., device="/dev/video0")`. On Windows/macOS there is only a single valid device `"OBS Virtual Camera"` when using the built-in backends. - Support for common pixel formats: RGB (default), BGR (useful for OpenCV), GRAY, I420, NV12, YUYV, UYVY. - New properties `Camera.fmt` (input format) and `Camera.native_fmt` (native format). diff --git a/README.md b/README.md index a451e6c..3b8fd82 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam: cam.sleep_until_next_frame() ``` -For more examples, including using different pixel formats like BGR, check out the [`samples/`](samples) folder. +For more examples, including using different pixel formats like BGR, or selecting a specific camera device on Linux, check out the [`samples/`](samples) folder. ## Installation @@ -64,7 +64,7 @@ sudo modprobe v4l2loopback devices=1 For further information, see the [v4l2loopback documentation](https://github.com/umlaeute/v4l2loopback). -pyvirtualcam uses the first available v4l2loopback virtual camera it finds. +If the `device` keyword argument is not given, then pyvirtualcam uses the first available v4l2loopback virtual camera it finds. The camera device name can be accessed with `cam.device`. ## Build from source diff --git a/pyvirtualcam/_version.py b/pyvirtualcam/_version.py index 3d18726..906d362 100644 --- a/pyvirtualcam/_version.py +++ b/pyvirtualcam/_version.py @@ -1 +1 @@ -__version__ = "0.5.0" +__version__ = "0.6.0" diff --git a/samples/video.py b/samples/video.py index aefda2f..3a5a9d8 100644 --- a/samples/video.py +++ b/samples/video.py @@ -1,4 +1,7 @@ # This script plays back a video file on the virtual camera. +# It also shows how to: +# - select a specific camera device +# - use BGR as pixel format import argparse import pyvirtualcam @@ -8,6 +11,7 @@ parser = argparse.ArgumentParser() parser.add_argument("video_path", help="path to input video file") parser.add_argument("--fps", action="store_true", help="output fps every second") +parser.add_argument("--device", help="virtual camera device, e.g. /dev/video0 (optional)") args = parser.parse_args() video = cv2.VideoCapture(args.video_path) @@ -18,7 +22,8 @@ height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps = video.get(cv2.CAP_PROP_FPS) -with pyvirtualcam.Camera(width, height, fps, fmt=PixelFormat.BGR, print_fps=args.fps) as cam: +with pyvirtualcam.Camera(width, height, fps, fmt=PixelFormat.BGR, + device=args.device, print_fps=args.fps) as cam: print(f'Virtual cam started: {cam.device} ({cam.width}x{cam.height} @ {cam.fps}fps)') count = 0 while True: diff --git a/samples/webcam_filter.py b/samples/webcam_filter.py index 3f0ad9e..d1522c1 100644 --- a/samples/webcam_filter.py +++ b/samples/webcam_filter.py @@ -1,5 +1,6 @@ # This scripts uses OpenCV to capture webcam output, applies a filter, # and sends it to the virtual camera. +# It also shows how to use BGR as pixel format. import argparse import cv2