pySimpleNDI is a library that that makes it easy to use NDI in Python.
download from https://ndi.tv/sdk/
only run installer.
- extract downloaded file.
- run
InstallNDISDK_v4_Linux.sh
in the extracted folder. - create symlink to
/NDI SDK for Linux/libndi.so.4
in/usr/lib
.
type pip install pysimplendi
.
NDISender can send np array([width, height, 3] or [width, height, 4])
import cv2
from pysimplendi import NDISender
# initialize sender
sender = NDISender("pysimplendi")
# transparent image [width, height, 4]
image = cv2.imread("examples/img/test-trans.png", cv2.IMREAD_UNCHANGED)
# normal image [width, height, 3]
image2 = cv2.imread("examples/img/test.png")
sender.send(image)
sender.send(image2)
NDISender can receive np array([width, height, 3] or [width, height, 4])
import cv2
from pysimplendi import NDIReceiver
receiver = NDIReceiver()
source_list = receiver.getSourceList()
# 1. get current frame
frame = receiver.getCurrentFrame()
# or
# 2. add handler
# call when frame received
def handler(image):
print(image.shape)
receiver.addHandler("test", handler)