I had one camera run in simple playback, non-recording mode for 10+ days without issue until I stopped it. The camera was plugged into a Netgear GS308P (inexpensive 8-port, 4 of which are PoE). This is the script I ran for that, taken from the Luxonis provided samples, fwiw:
#!/usr/bin/env python3
import cv2
import depthai as dai
# aicam6
aicamip="192.168.1.6"
found, device_info = dai.Device.getDeviceByMxId(aicamip)
print(aicamip)
print(device_info)
if not found:
raise RuntimeError("Device not found!")
# Create pipeline
pipeline = dai.Pipeline()
# Define source and output
camRgb = pipeline.createColorCamera()
xoutVideo = pipeline.createXLinkOut()
xoutVideo.setStreamName("video")
# Properties
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setVideoSize(1920, 1080)
xoutVideo.input.setBlocking(False)
xoutVideo.input.setQueueSize(1)
# Linking
camRgb.video.link(xoutVideo.input)
# Connect to device and start pipeline
with dai.Device(pipeline) as device:
video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
while True:
videoIn = video.get()
# Get BGR frame from NV12 encoded video frame to show with opencv
# Visualizing the frame on slower hosts might have overhead
cv2.imshow("video", videoIn.getCvFrame())
if cv2.waitKey(1) == ord('q'):
break
I do have some other cameras that I have been recording from, using this:
#!/usr/bin/env python3
import depthai as dai
aicamip="192.168.1.6"
found, device_info = dai.Device.getDeviceByMxId(aicamip)
print(aicamip)
if not found:
raise RuntimeError("Device not found!")
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and output
camRgb = pipeline.createColorCamera()
videoEnc = pipeline.createVideoEncoder()
xout = pipeline.createXLinkOut()
xout.setStreamName('h265')
# Properties
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_4_K)
videoEnc.setDefaultProfilePreset(3840, 2160, 30, dai.VideoEncoderProperties.Profile.H265_MAIN)
# Linking
camRgb.video.link(videoEnc.input)
videoEnc.bitstream.link(xout.input)
# Connect to device and start pipeline
with dai.Device(pipeline, device_info) as device:
# Output queue will be used to get the encoded data from the output defined above
q = device.getOutputQueue(name="h265", maxSize=30, blocking=True)
# The .h265 file is a raw stream file (not playable yet)
with open('ai-cam6-deer.h265', 'wb') as videoFile:
print("Press Ctrl+C to stop encoding...")
try:
while True:
h265Packet = q.get() # Blocking call, will wait until a new data has arrived
h265Packet.getData().tofile(videoFile) # Appends the packet data to the opened file
except KeyboardInterrupt:
# Keyboard interrupt (Ctrl + C) detected
pass
print("To view the encoded data, convert the stream file (.h265) into a video file (.mp4) using a command below:")
print("ffmpeg -framerate 30 -i video.h265 -c copy video.mp4")
This sometimes terminates for unknown reasons, but typically can run for hours/days. Causes for outages can include power or network. You could leave a ping running to the device and another device similarly situated on the network and see if there are issues. Also, have your PoE switch on UPS/battery.
Happy hacking!