txlyre před 7 měsíci
rodič
revize
803d39e16e
1 změnil soubory, kde provedl 5 přidání a 6 odebrání
  1. 5 6
      main.py

+ 5 - 6
main.py

@@ -128,7 +128,7 @@ def extract_lsbs(data):
 
     data = [k for k, _ in groupby(data)]
     data = chunks(data, 8)
-        
+
     for chunk in data:
         if len(chunk) != 8:
             break
@@ -242,16 +242,15 @@ def sample(source, source_type, multiplier=1):
 
 def video2_sampler(q, source):
     with Device.from_id(abs(int(source))) as device:
-        capture = VideoCapture(device)
-        capture.set_format(
-            device.info.frame_sizes[0].width, device.info.frame_sizes[0].height, "YUYV"
+        device.set_format(
+            1, device.info.frame_sizes[0].width, device.info.frame_sizes[0].height, pixel_format="YUYV"
         )
 
         last = 0
-        for frame in capture:
+        for frame in device:
             new = time.monotonic()
 
-            if new - last > 5:
+            if new - last > 1.5:
                 data = extract_lsbs(bytes(frame))
                 data = whiten(data)