Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 59 additions & 6 deletions millicast/playback/frame-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import MetadataFeature from '../assets/img/metadata-feature.png';

Metadata is encoded into the frame at broadcast and then extracted by the Client SDK at playback time.

- There is a **timecode** that will be supplied by the broadcaster and carried through the platform and available at playback.
- There is a **timecode** that will be supplied by the broadcaster and carried through the platform and available at playback. (See [Timecode Metadata](#timecode-metadata))
- Application supplied metadata is incorporated as **unregistered** SEI messages. These are received as `Byte` arrays if unable to be converted into JSON objects.
- It is recommended to limit the amount of data that is packaged with the frame as this increases the size of each frame for distribution (impacting latency and bandwidth costs).
- There may be marginal overhead in encoding and decoding messages, so you must enable **metadata** when establishing a connection if you want to send or receive.
Expand All @@ -41,14 +41,67 @@ With WebRTC and a UDP connection, latency is prioritized over reliable delivery

When receiving metadata there is a `uuid` attribute that can be used to uniquely identify the source of the metadata in cases of multiple publishing sources. The table includes a few examples:

| UUID | Description |
| :----------------------------------- | :--------------------------------------------------- |
| 9a21f3be-31f0-4b78-b0be-c7f7dbb97250 | SEI metadata inserted from AMF OnFi message feeds. |
| d40e38ea-d419-4c62-94ed-20ac37b4e4fa | SEI metadata inserted by the Web SDK. |
| dc45e9bd-e6d9-48b7-962c-d820d923eeef | SEI metadata inserted by libavc such as with ffmpeg. |
| UUID | Description |
| :----------------------------------- | :------------------------------------------------- |
| 9a21f3be-31f0-4b78-b0be-c7f7dbb97250 | SEI metadata inserted from AMF OnFi message feeds. |
| d40e38ea-d419-4c62-94ed-20ac37b4e4fa | SEI metadata inserted by the Web SDK. |

For **PIC_TIMING** SEI messages that are inserted by various encoders, there will not be a UUID assigned and included with the frame.

### Timecode Metadata

There are several ways to send and receive timecode into the service which can be extracted in the player.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcoffey3296 should this be "timecodes" instead of just "timecode"?


1. Embed pic_timing (part of SEI metadata) in the `h264` video stream (this is automatically inserted with some encoders)
1. Send RTMP with onFi (part of OnMetaData in AMF metadata). The service will read this value from the RTMP stream and insert it into the SEI metadata of the timecode (See [Metadata Source Identification](#metadata-source-identification))

Here is an example of a frame's metadata that has pic_timing from the SEI in the `metadata` callback:

```json
{
"seiPicTimingTimeCodeArray": [
{
"n_frames": 20,
"seconds_value": 57,
"minutes_value": 51,
"hours_value": 19,
"time_offset": 0
}
],
"mid": "0",
"track": {}
}
```

If you have metadata from onFi, here is what that metadata will look like (note the UUID indicating the source from onFi):

```json
{
"uuid": "9a21f3be-31f0-4b78-b0be-c7f7dbb97250",
"timecode": "2026-02-11T19:49:16.299Z",
"seiPicTimingTimeCodeArray": [
{
"n_frames": 9,
"seconds_value": 16,
"minutes_value": 49,
"hours_value": 19,
"time_offset": 0
}
],
"mid": "0",
"track": {}
}
```

Here is an example of consuming this metadata in JavaScript:

```javascript
millicastView.on('metadata', (metadata) => {
updateMetadataDisplay(metadata);
processTimecodeDisplay(metadata);
});
```

## Web SDK

When using the [Web SDK](/millicast/playback/players-sdks/web/sdk/index.mdx) to set and get frame metadata, you must include the `metadata` option to the `connect()` method on both [Publish](https://millicast.github.io/millicast-sdk/Publish.html#connect) and [View](https://millicast.github.io/millicast-sdk/View.html#connect) connections..
Expand Down