Closed koratkar closed 3 years ago
Thanks for your contribution, however I don't think it fits into the package as it can be easily done outside. I also wouldn't like introducing a new dependency (pillow) just for this feature. The package should have the minimal functionality possible to allow people to use it in different circumstances.
That makes sense, could this code be helpful in the samples folder?
Yeah definitely, that's a good idea.
Are you still working on this?
Yes, I just wrote a better one that can loop over video `import pyvirtualcam import numpy as np from numpy import asarray import cv2
path = 'PATH.mp4' video = cv2.VideoCapture(path) length = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) count = 0 with pyvirtualcam.Camera(width=1280, height=720, fps=20) as cam: while True: if count == length: count = 0 video.set(1,count) s,frame = video.read() frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) array_frame = asarray(frame) frame = np.zeros((cam.height, cam.width, 4), np.uint8) frame[:,:,:3] = array_frame cam.send(frame) cam.sleep_until_next_frame() count = count + 1`
Sorry about delay
That's a great sample, do you want to change your PR to use this then?
Thanks so much for writing this package!