Skip to content

✨FEATURE: Add emotion timeline output to Sentiment API #14

@jvJUCA

Description

@jvJUCA

Context

Currently, the Sentiment API returns only the overall average of emotions across the entire video, in the following format:

{
  "emotions": {
    "Angry": 15.38,
    "Disgusted": 7.69,
    "Fearful": 0.0,
    "Happy": 0.0,
    "Neutral": 53.85,
    "Sad": 23.08,
    "Surprised": 0.0
  }
}

This is not enough for the frontend, which needs to build an emotional timeline throughout the video.


Problem

  • There is no information about when each emotion occurs
  • It is not possible to render charts or timelines
  • A global average loses important temporal context

Proposal

In addition to the overall average, the API should return a time-based array segmented by fixed intervals.


Expected payload

{
  "average_emotions": {
    "Angry": 15.38,
    "Disgusted": 7.69,
    "Fearful": 0.0,
    "Happy": 0.0,
    "Neutral": 53.85,
    "Sad": 23.08,
    "Surprised": 0.0
  },
  "timeline": [
    {
      "id": 1,
      "starting_time": "00:00",
      "ending_time": "00:10",
      "emotion": "SURPRISED",
      "value": 54
    },
    {
      "id": 2,
      "starting_time": "00:10",
      "ending_time": "00:20",
      "emotion": "NEUTRAL",
      "value": 62
    }
  ]
}

Requirements

  • Configurable time intervals (e.g. 5s, 10s) or when change the dominant emotion
  • Dominant emotion per interval
  • value representing intensity/confidence (%)
  • Maintain backward compatibility (overall average must still be returned)

Benefits

  • Enables emotion timeline visualization on the frontend
  • Provides richer context for UX analysis
  • Data can be reused for charts and insights

Note

The frontend is already prepared to consume this format.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions