---
updatedAt: 2026-06-12T11:16:53.000Z
agentTools:
  projectIndex: https://apidocs.neuronsinc.com/llms.txt
---

# Calculate Scene Metrics

# Calculate metrics per scene
Specify the scene transition ids or leave it blank for automatic scene detection

## Pre-requisites

You must have an existing video with an associated *media\_id* and the prediction status as done.

Use the *media\_id* to send the **POST** request to the endpoint `/predict/v2/videos/media_id/scene_detection`

Metrics can be calculated for **predefined scenes** or, in case no scene transition frames are provided, the **scene detection is automated**,and scores are presented from the defined or auto-detected scenes.

## Expected request payload for predefined scene metrics

The *scene\_transition\_frames* are optional.

```json JSON
{
    "scene_transition_frames": [ 353, 578 ]
}
```

The transition frames signify the "boundaries" of each scene. So if, for example, in a video with 800 frames, the provided transition frames are 353 and 578, as showcased above, then the metrics will be calculated for 3 scenes:

1. From frame 1 until frame 352
2. From frame 353 until frame 577
3. From frame 578 until frame 800

For automated scene detection, no payload should be sent.

## Example of a successful response

The results present the average of the prediction metrics for each scene. Each scene is defined by a unique identifier in the form of a UUID.

```json JSON
{
  "media_id": "c88ded20-69ad-457e-ae34-d04dfa9ad447", 
  "success": true, 
  "message": "OK", 
  "results": {
    "684b309b-5c75-434f-8db7-3f94f1bdda75": {
      "start_frame": 1, 
      "end_frame": 352, 
      "focus": 80.50604034612387, 
      "cognitive_demand": 45.078818846324495, 
      "memory": 56.21344592314347, 
      "engagement_frt": 62.88968305369173, 
      "aois": [
        {
          "uuid": "b8eded7a-1d2d-5452-df39-4fa7298ab972",
        	"name": "Getty Images",
       		"availability": 0.08333333333333333,
        	"total_attention": 23.5226571559906,
        	"relative_attention": 23.5226571559906          
        }
      ]
    }, 
    "08244ec2-0e41-40ea-8341-364415c452a9": {
      "start_frame": 353, 
      "end_frame": 577, 
      "focus": 87.38416864131615, 
      "cognitive_demand": 47.39792340437856, 
      "memory": 58.96938118994907, 
      "engagement_frt": 59.803821352594724, 
      "aois": [
        {
          "uuid": "b8eded7a-1d2d-5452-df39-4fa7298ab972",
          "name": "Getty Images",
          "availability": 0.7083333333333334,
          "total_attention": 31.4802991993287,
          "relative_attention": 31.4802991993287          
        }
      ]
    }, 
    "f7b93f99-cd0a-4627-986e-a7b46644c3df": {
      "start_frame": 578, 
      "end_frame": 800, 
      "focus": 68.33355230263865, 
      "cognitive_demand": 72.30813829044762, 
      "memory": 72.1463888155716, 
      "engagement_frt": 49.55575712129309, 
      "aois": [
        {
          "uuid": "b8eded7a-1d2d-5452-df39-4fa7298ab972",
          "name": "Getty Images",
          "availability": 0.5833333333333334,
          "total_attention": 0.6565483934853388,
          "relative_attention": 12.94338261442525
        }
      ]
    }
  }
}
```

In videos containing AOIs (static or autodetected) the scene metrics also contain the availability, total and relative attention of each video AOI per scene.

<br />

<br />

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Neurons Customers API v2",
    "version": "2.0.0",
    "description": "Neurons Customers API"
  },
  "paths": {
    "/predict/v2/videos/{media_id}/scene_detection": {
      "post": {
        "operationId": "calculateSceneMetrics",
        "summary": "Calculate Scene Metrics",
        "parameters": [
          {
            "in": "path",
            "name": "media_id",
            "schema": {
              "format": "uuid4",
              "title": "Media Id",
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SceneDetectionResults"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          },
          "412": {
            "description": "Precondition Failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Detail"
                }
              }
            }
          }
        },
        "description": "# Calculate metrics per scene\nSpecify the scene transition ids or leave it blank for automatic scene detection",
        "tags": [
          "Videos"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SceneDetectionIn"
              }
            }
          },
          "required": false
        },
        "security": [
          {
            "LegacyPredictAPIAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Detail": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          }
        },
        "required": [
          "detail"
        ],
        "title": "Detail",
        "type": "object"
      },
      "AOISceneMetrics": {
        "properties": {
          "uuid": {
            "title": "Uuid",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "availability": {
            "title": "Availability",
            "type": "number"
          },
          "total_attention": {
            "title": "Total Attention",
            "type": "number"
          },
          "relative_attention": {
            "title": "Relative Attention",
            "type": "number"
          }
        },
        "required": [
          "uuid",
          "name",
          "availability",
          "total_attention",
          "relative_attention"
        ],
        "title": "AOISceneMetrics",
        "type": "object"
      },
      "SceneDetectionMetrics": {
        "properties": {
          "start_frame": {
            "title": "Start Frame",
            "type": "integer"
          },
          "end_frame": {
            "title": "End Frame",
            "type": "integer"
          },
          "focus": {
            "title": "Focus",
            "type": "number"
          },
          "cognitive_demand": {
            "title": "Cognitive Demand",
            "type": "number"
          },
          "memory": {
            "title": "Memory",
            "type": "number"
          },
          "engagement_frt": {
            "title": "Engagement Frt",
            "type": "number"
          },
          "aois": {
            "items": {
              "$ref": "#/components/schemas/AOISceneMetrics"
            },
            "title": "Aois",
            "type": "array"
          }
        },
        "required": [
          "start_frame",
          "end_frame",
          "focus",
          "cognitive_demand",
          "memory",
          "engagement_frt",
          "aois"
        ],
        "title": "SceneDetectionMetrics",
        "type": "object"
      },
      "SceneDetectionResults": {
        "properties": {
          "media_id": {
            "format": "uuid4",
            "title": "Media Id",
            "type": "string"
          },
          "success": {
            "title": "Success",
            "type": "boolean"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "results": {
            "additionalProperties": {
              "$ref": "#/components/schemas/SceneDetectionMetrics"
            },
            "title": "Results",
            "type": "object"
          }
        },
        "required": [
          "media_id",
          "success",
          "message",
          "results"
        ],
        "title": "SceneDetectionResults",
        "type": "object"
      },
      "SceneDetectionIn": {
        "properties": {
          "scene_transition_frames": {
            "title": "Scene Transition Frames",
            "items": {
              "type": "integer"
            },
            "type": "array"
          }
        },
        "title": "SceneDetectionIn",
        "type": "object"
      }
    },
    "securitySchemes": {
      "LegacyPredictAPIAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.neuronsinc.com"
    }
  ]
}
```