> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/platform/abilities/open-vocabulary/classify-an-event.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# Classify an event

Ask which events, actions or activities happen in a video, with prompts you write, chunk by chunk

`eyepop.qwen3.event-classify` watches a video in short chunks and answers, for each chunk, which of your prompts happen in it: anything that takes place over time, like a ball rolling across the ground or a box falling down. It runs on `qwen3`, the vision-language model on EyePop's GPUs, which sees the frames of a chunk together. Unlike `eyepop.qwen3.classify`, it can tell what happens across those frames, not just what one frame shows.

{% hint style="info" %}
**Video only.** Each chunk is one request to the model, and its answer comes back as `classes` on a prediction with the chunk's `timestamp`. Run it on a single image and there is nothing to watch: use [`eyepop.qwen3.classify`](https://docs.eyepop.ai/platform/abilities/open-vocabulary/promptable-vlm-tasks.md#vlms-classify) instead.
{% endhint %}

### Classify events in a video

The example runs on an 8 second clip, 640 x 360 at 15 frames per second, that shows one event in each two-second chunk: nothing at first, then a red ball rolls across the ground, a box falls from the sky, and the ball bounces in place. Download it to run the example yourself:

{% file src="/files/97DxhHmLMHCCoy8x8I4h" %}
The 8 second example clip, `event-classify-demo.mp4`
{% endfile %}

Each prompt describes an event; the label is the name your application wants back. Every chunk answers on its own, and returns only the prompts that happen in it:

```json
{
  "components": [
    {
      "type": "inference",
      "ability": "eyepop.qwen3.event-classify:latest",
      "params": {
        "prompts": [
          { "prompt": "a ball rolls across the ground", "label": "rolling" },
          { "prompt": "a box falls down from above", "label": "falling" },
          { "prompt": "a ball bounces up and down", "label": "bouncing" }
        ]
      }
    }
  ]
}
```

One prediction per chunk, at the chunk's start:

```json
[
  { "timestamp": 0,          "seconds": 0, "duration": 1999999999 },
  { "timestamp": 2000000000, "seconds": 2, "duration": 1999999999, "classes": [{ "classLabel": "rolling",  "confidence": 0.9955 }] },
  { "timestamp": 4000000000, "seconds": 4, "duration": 1999999999, "classes": [{ "classLabel": "falling",  "confidence": 0.9774 }] },
  { "timestamp": 6000000000, "seconds": 6, "duration": 1999999999, "classes": [{ "classLabel": "bouncing", "confidence": 0.9792 }] }
]
```

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-803ac417038e12c745635ad52ccd6d27544adb2d%2Fopen-vocabulary-event-classify.jpg?alt=media" alt="Four panels, one per two-second chunk of the clip, each showing what moved in it as a fading trail: 0–2 s an empty scene, no event; 2–4 s the ball rolling across the ground, rolling 1.00; 4–6 s the box falling from the sky, falling 0.98; 6–8 s the ball bouncing, bouncing 0.98"><figcaption><p>Each chunk answers with the event that happens in it, and the empty first chunk with none.</p></figcaption></figure>

A chunk in which none of the events happens has no `classes`, like the first one here. The prompts are independent questions, so a chunk in which two of the events happen answers both. The `confidence` is the probability the model gave the label, among your labels only: with a single prompt it is always 1.0.

### Chunk length

By default each chunk is two seconds long. An event shorter than a chunk is still seen, but its `timestamp` only says which chunk it happened in. A longer chunk gives the model more context for slow events and costs less per second of video; a shorter one places events more precisely. Set the length in seconds with the component's `videoChunkLengthSeconds`. The same Pop with four-second chunks:

```json
{
  "type": "inference",
  "ability": "eyepop.qwen3.event-classify:latest",
  "videoChunkLengthSeconds": 4,
  "params": {
    "prompts": [
      { "prompt": "a ball rolls across the ground", "label": "rolling" },
      { "prompt": "a box falls down from above", "label": "falling" },
      { "prompt": "a ball bounces up and down", "label": "bouncing" }
    ]
  }
}
```

The clip now comes back as two chunks:

```json
[
  { "timestamp": 0,          "seconds": 0, "duration": 3999999999, "classes": [{ "classLabel": "rolling", "confidence": 0.7938 }] },
  { "timestamp": 4000000000, "seconds": 4, "duration": 3999999999, "classes": [{ "classLabel": "falling", "confidence": 0.9314 }, { "classLabel": "rolling", "confidence": 0.7309 }] }
]
```

Each chunk now holds two of the clip's events, and the answers get less sure: the first chunk is still `rolling`, but in the second the bouncing ball is read as `rolling`, and `bouncing` is missed. Choose a chunk about as long as the events you look for.

An event that falls across the boundary of two chunks is split between them, and may be missed by both. `videoChunkOverlap` makes each chunk start with the end of the one before: with `0.25`, the last second of every four-second chunk is seen again at the start of the next, so chunks start every three seconds. The overlapping frames are processed, and billed, twice. A source can set its own length and overlap with [component parameters](https://docs.eyepop.ai/platform/sources-and-options/options/component-parameters.md#video-chunking).

The `video_chunk_length_ns` and `video_chunk_overlap` params still work, below the component's attributes, but are deprecated.

### Instructions

The prompts say *what* to look for. `instructions` says *how to look*: which part of the scene matters, what to ignore, what the camera shows. They are added to the model's own instructions for the task, so they cannot change the shape of the answer. Up to 2000 characters. The same Pop, told to watch only the ball:

```json
{
  "type": "inference",
  "ability": "eyepop.qwen3.event-classify:latest",
  "params": {
    "instructions": "Only watch the red ball. Ignore the box and anything that happens to it.",
    "prompts": [
      { "prompt": "a ball rolls across the ground", "label": "rolling" },
      { "prompt": "a box falls down from above", "label": "falling" },
      { "prompt": "a ball bounces up and down", "label": "bouncing" }
    ]
  }
}
```

The box still falls in the third chunk, but the answer no longer reports it:

```json
[
  { "timestamp": 0,          "seconds": 0, "duration": 1999999999 },
  { "timestamp": 2000000000, "seconds": 2, "duration": 1999999999, "classes": [{ "classLabel": "rolling",  "confidence": 0.9948 }] },
  { "timestamp": 4000000000, "seconds": 4, "duration": 1999999999 },
  { "timestamp": 6000000000, "seconds": 6, "duration": 1999999999, "classes": [{ "classLabel": "bouncing", "confidence": 0.9783 }] }
]
```

`instructions` works the same on [`classify` and `detect`](https://docs.eyepop.ai/platform/abilities/open-vocabulary/promptable-vlm-tasks.md#instructions) of every VLM.

### Run it on a video

Save the Pop as `pop.json` next to [the clip](#classify-events-in-a-video), `event-classify-demo.mp4`, and run it with this code, which prints the events of each chunk:

{% tabs %}
{% tab title="Python" %}

```python
import json

from eyepop import EyePopSdk
from eyepop.worker.worker_types import Pop

pop = Pop.model_validate(json.load(open("pop.json")))

with EyePopSdk.sync_worker(pop=pop) as endpoint:
    job = endpoint.upload("event-classify-demo.mp4")
    while result := job.predict():
        labels = [c["classLabel"] for c in result.get("classes", [])]
        print(f"{result.get('seconds', 0):6.1f}s  {', '.join(labels) or '-'}")
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { readFileSync } from 'node:fs'
import { EyePop, type Pop } from '@eyepop.ai/eyepop'

const pop: Pop = JSON.parse(readFileSync('pop.json', 'utf8'))
const endpoint = await EyePop.workerEndpoint({ pop }).connect()

try {
    const results = await endpoint.process({ source: { path: 'event-classify-demo.mp4' } })
    for await (const result of results) {
        const labels = (result.classes ?? []).map(c => c.classLabel)
        console.log(`${(result.seconds ?? 0).toFixed(1).padStart(6)}s  ${labels.join(', ') || '-'}`)
    }
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

```
   0.0s  -
   2.0s  rolling
   4.0s  falling
   6.0s  bouncing
```

### Your own event ability

To keep the prompts, instructions and chunk length in an ability instead of the Pop, create a [task-mode ability](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks/task-mode.md#classify-an-event) with the task `event_classification`.

### Next steps

* [Promptable VLM tasks](https://docs.eyepop.ai/platform/abilities/open-vocabulary/promptable-vlm-tasks.md) — `classify` and `detect` on images with the same prompts
* [Task mode: classify, detect or classify events](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks/task-mode.md) — the task mode behind these abilities
* [Temporal attributes](https://docs.eyepop.ai/platform/response-format/temporal-attributes.md) — `timestamp`, `seconds` and `duration` on a video's predictions

Questions about building a Pop? Reach us at <help@eyepop.ai>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/platform/abilities/open-vocabulary/classify-an-event.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
