Skip to main content

Seeking Alternative Endpoint for Motion Detection Images in API

Answered

Comments

2 comments

  • Ichiro
    • Network Optix team

    Hi Gaspar Gómez,

    Thanks for your question. Please check the comment below.

    1) Motion indicators and Objects have essential difference in DB. At the moment, we don't have the similar API for motion as object tracks. 

    2) Although we don't have the API to extract the DB at the moment, but you can legacy the event log and the API of getting event log.

    - Set the event rule of a specific device that you desired.
    - Use the API /ec2/getEvents (in 5.1.x) and /rest/v3/servers/{serverId}/events to get the event list within the time duration.
    - You can see the response from the API includes the deviceId and timestamp.
    - Then you would be able to get the snapshot if required via /rest/v3/device/{id}/image

    {
            "actionParams": {
                "allUsers": false,
                "authType": "authBasicAndDigest",
                "durationMs": 5000,
                "forced": true,
                "fps": 10,
                "needConfirmation": false,
                "playToClient": true,
                "recordAfter": 0,
                "recordBeforeMs": 1000,
                "streamQuality": "highest",
                "useSource": false
            },
            "actionType": "diagnosticsAction",
            "aggregationCount": 1,
            "businessRuleId": "{c8a71423-857f-40d4-b059-8fd047f9283f}",
            "eventParams": {
                "eventResourceId": "{a19ccfc0-ed3d-ff9b-53c3-18a2f8080f3b}",
                "eventTimestampUsec": "1716439028930044",
                "eventType": "cameraMotionEvent",
                "metadata": {
                    "allUsers": false,
                    "level": ""
                },
                "omitDbLogging": false,
                "progress": 0,
                "reasonCode": "none",
                "sourceServerId": "{a9edb67b-5679-704b-cb0e-dda40fcc0baa}"
            },
            "flags": 1
      }
    }

     

    I am not sure what might be causing the thumbnail is slow, but there are lots of reason, ex: networking, resolution, storage performance, and etc.
    So I would suggest if you really want to use that API, it cause me about 4 seconds to get a 2592*1944 live image across the VPN via a 250Mbps WIFI. 

    0
  • Ichiro
    • Network Optix team

    Hi Gaspar Gómez,

    Another possible approach is to extract the motion indicator from the recording.
    You may be able to use the API - /rest/v2/devices/{id}/footage, and search only the. chunks that have motion event indicator existed. The format will be :

    https://[server_ip]:[port]/rest/v2/[camera_id]/footage?periodType=motion 

    Then you would be able to see the duration of the motion event and the triggered time of the event.

    {"durationMs":67,"serverId":"{a9edb67b-5679-704b-cb0e-dda40fcc0baa}","startTimeMs":1711466146410},
    {"durationMs":2331,"serverId":"{a9edb67b-5679-704b-cb0e-dda40fcc0baa}","startTimeMs":1711466147410},
    {"durationMs":3001,"serverId":"{a9edb67b-5679-704b-cb0e-dda40fcc0baa}","startTimeMs":1711466171742},
    ...

    Using this motion/recording chunk information, then you may probably get better shot of the moving object.
    The general practice is that you can get the clear one that add 200-300 milliseconds from the start of the chunk.

    Last, you may download the thumbnail using the timestamp accordingly.

    0

Please sign in to leave a comment.