I want to stream mp4 videos to a virtual webcam using python. I have tried using pyvirtualcam with the following code:
def play_video(path):
vid = skvideo.io.vread(path)
print(vid.shape)
for frame in vid:
cam.send(frame)
cam.sleep_until_next_frame()
with pyvirtualcam.Camera(width=1080, height=1920, fps=60, print_fps=True) as cam:
print(f'Using virtual camera: {cam.device}')
while True:
play_video("final.mp4")
This works, however it is so slow that it is unusable (running on a very powerful PC). So my question is, if there is any more elegant way of streaming videos to a virtual camera.
Thanks