letmaik / pyvirtualcam

🎥 Send frames to a virtual camera from Python
GNU General Public License v2.0
452 stars 49 forks source link

Latency #45

Closed mmkolbe closed 3 years ago

mmkolbe commented 3 years ago

I'm reading a RTSP Stream from a DVR, and trying to make a virtual webcam device to be available on my Windows 10. It works pretty nice, but there is a delay, about 1,92 sec latency. Tested on other python app and on AMCAP, and always the latency is that high. Is it related to pyvirtualcam or to OBS stuff? Is there any way to get a lower latency? Thank you all.

letmaik commented 3 years ago

How do you measure latency? When I run samples/webcam_filter.py --filter none I'm getting an estimated 100-200ms latency when moving my hand around quickly.

mmkolbe commented 3 years ago

I've manually used a chronometer app, on cellphone. It's only to say that, by this way (trying to transfer a stream), the lantency is a real problem. Using the gray animation available on the repo, the latency is pretty discrete, some milisecs.

letmaik commented 3 years ago

I'm going to close this issue since you verified that the extra latency is not coming from pyvirtualcam but rather your end-to-end process of sending and receiving the RTSP stream (which very likely involves buffering) etc. I will add a new sample which should make it easier to evaluate latency without needing a webcam, like a discrete change of colors every second together with a log statement on the console when it happened.

letmaik commented 3 years ago

See the new samples/latency.py sample.

mmkolbe commented 3 years ago

Hi letmaik. I used the parameter "delay = 0" on the Camera constructor and now there the problem is gone. Thank you very much.

letmaik commented 3 years ago

delay is not used anymore since 0.4.0. It has no effect. I will fully remove it in the next release.