Update send_video.py
This commit is contained in:
@@ -22,7 +22,7 @@ def main():
|
||||
while time.time() - start < 60 * 5:
|
||||
start_send = time.time()
|
||||
|
||||
for idx in reversed(range(200)):
|
||||
for _ in reversed(range(200)):
|
||||
|
||||
ret, img = cap.read()
|
||||
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
import sys
|
||||
import time
|
||||
import numpy as np
|
||||
import NDIlib
|
||||
import ctypes
|
||||
import NDIlib as ndi
|
||||
|
||||
def main():
|
||||
|
||||
if not NDIlib.initialize():
|
||||
if not ndi.initialize():
|
||||
return 0
|
||||
|
||||
ndi_send = NDIlib.send_create()
|
||||
ndi_send = ndi.send_create()
|
||||
|
||||
if ndi_send is 0:
|
||||
if ndi_send is None:
|
||||
return 0
|
||||
|
||||
img = np.zeros((1080, 1920, 4), dtype=np.uint8)
|
||||
h, w = img.shape[:2]
|
||||
|
||||
video_frame = NDIlib.VideoFrameV2()
|
||||
video_frame = ndi.VideoFrameV2()
|
||||
|
||||
video_frame.xres = w
|
||||
video_frame.yres = h
|
||||
video_frame.FourCC = NDIlib.FOURCC_TYPE_BGRX
|
||||
#video_frame.data = img.ctypes.data_as(NDIlib.POINTER(NDIlib.c_uint8))
|
||||
#video_frame.data = img.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8))
|
||||
print(type(video_frame.data))
|
||||
video_frame.data = img
|
||||
video_frame.FourCC = ndi.FOURCC_VIDEO_TYPE_BGRX
|
||||
|
||||
start = time.time()
|
||||
while time.time() - start < 60 * 5:
|
||||
@@ -32,13 +26,13 @@ def main():
|
||||
|
||||
for idx in reversed(range(200)):
|
||||
img.fill(255 if idx % 2 else 0)
|
||||
NDIlib.send_send_video_v2(ndi_send, video_frame)
|
||||
ndi.send_send_video_v2(ndi_send, video_frame)
|
||||
|
||||
print('200 frames sent, at %1.2ffps' % (200.0 / (time.time() - start_send)))
|
||||
|
||||
NDIlib.send_destroy(ndi_send)
|
||||
ndi.send_destroy(ndi_send)
|
||||
|
||||
NDIlib.destroy()
|
||||
ndi.destroy()
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user