• SDK: hardcode recording duration?

Noob question here, probably. I am trying to use the sdk to record RGB+left+right. But my host is a pi without X, which I control remotely via ssh. My problem: if I get it right, the record example using sdk expects the recording to be ended using "q" in a cv2 window… which I can't do.

I'm not familiar with abstracted objects like the sdk, but I can't just code a timer into the while loop, like I did using the API, as it is abstracted…

I tried with this:

start_time = time.monotonic()

while oak.running():

if time.monotonic() - start_time > 5:

oak._stop = True

oak.poll()

But it doesn't seem to be working that way !

  • erik replied to this.
    • Best Answerset by erik

    Hi K2_ ,
    With depthai-sdk==1.9.5, script below worked for me. I hope it helps!
    Thanks, Erik

    from depthai_sdk import OakCamera, RecordType
    import time
    
    with OakCamera() as oak:
        color = oak.create_camera('color', resolution='1080P', fps=10, encode='H265')
        left = oak.create_camera('left', resolution='800p', fps=10, encode='H265')
        right = oak.create_camera('right', resolution='800p', fps=10, encode='H265')
    
        # Sync & save all (encoded) streams
        oak.record([color.out.encoded, left.out.encoded, right.out.encoded], './record')
        oak.start()
        start_time = time.monotonic()
        while oak.running():
            if time.monotonic() - start_time > 5:
                break
            oak.poll()

    Hi K2_ ,
    With depthai-sdk==1.9.5, script below worked for me. I hope it helps!
    Thanks, Erik

    from depthai_sdk import OakCamera, RecordType
    import time
    
    with OakCamera() as oak:
        color = oak.create_camera('color', resolution='1080P', fps=10, encode='H265')
        left = oak.create_camera('left', resolution='800p', fps=10, encode='H265')
        right = oak.create_camera('right', resolution='800p', fps=10, encode='H265')
    
        # Sync & save all (encoded) streams
        oak.record([color.out.encoded, left.out.encoded, right.out.encoded], './record')
        oak.start()
        start_time = time.monotonic()
        while oak.running():
            if time.monotonic() - start_time > 5:
                break
            oak.poll()

    Thanks again Eric ! Working here too !