Hello !
When streaming two IMX296 with my FFC-4P, I noticed that there is a delay between the real world and the video that increases over time.
I don't notice this problem when displaying the cvFrames directly, which could point to the videoencoder being overwhelmed ?
However, I don't have this issue with IMX378 running (almost) the same code, the only difference is the SensorResolution, which is actually larger with the IMX378 (1920x1080 vs 1440x1080).
Here is a minimal example that exposes this behaviour
import depthai as dai
import subprocess as sp
stringToCam = {
"CAM_A": dai.CameraBoardSocket.CAM_A,
"CAM_B": dai.CameraBoardSocket.CAM_B,
"CAM_C": dai.CameraBoardSocket.CAM_C,
"CAM_D": dai.CameraBoardSocket.CAM_D,
}
cams_ids = ["CAM_B", "CAM_C"]
pipeline = dai.Pipeline()
fps = 60
cams = {}
for cam_id in cams_ids:
cam_node = pipeline.createColorCamera()
cam_node.setBoardSocket(stringToCam[cam_id])
cam_node.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1440X1080)
cam_node.setFps(fps)
manip = pipeline.createImageManip()
manip.initialConfig.setResizeThumbnail(1280, 720)
manip.setMaxOutputFrameSize(1280 * 720 * 3)
manip.initialConfig.setFrameType(dai.ImgFrame.Type.NV12)
encoder = pipeline.createVideoEncoder()
profile = dai.VideoEncoderProperties.Profile.H264_MAIN
encoder.setDefaultProfilePreset(fps, profile)
cam_node.isp.link(manip.inputImage)
manip.out.link(encoder.input)
out = pipeline.createXLinkOut()
out.setStreamName(cam_id)
encoder.bitstream.link(out.input)
cams[cam_id] = cam_node
device = dai.Device()
device.startPipeline(pipeline)
queue = {}
for cam_id in cams_ids:
queue[cam_id] = device.getOutputQueue(cam_id, maxSize=30, blocking=True)
def spawn_procs(names):
width, height = 1280, 720
command = [
"ffplay",
"-i",
"-",
"-x",
str(width),
"-y",
str(height),
"-framerate",
"60",
"-fflags",
"nobuffer",
"-flags",
"low_delay",
"-framedrop",
"-strict",
"experimental",
]
procs = {}
try:
for name in cams_ids:
procs[name] = sp.Popen(command, stdin=sp.PIPE) # Start the ffplay process
except Exception:
exit("Error: cannot run ffplay!\nTry running: sudo apt install ffmpeg")
return procs
procs = spawn_procs(cams)
while True:
for cam_id in cams_ids:
frame = queue[cam_id].get()
procs[cam_id].stdin.write(frame.getData())
Any idea ?
Thanks !
Antoine