# place.stream.segment

> Media file representing a segment of a livestream

- Kind: record
- Record key: tid
- Authority: stream.place
- Lexicon: 1
- Published by [stream.place](https://lexicon.garden/identity/did:plc:rbvrr34edl5ddpuwcubjiost), not the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.segment)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.segment/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:rbvrr34edl5ddpuwcubjiost/place.stream.segment/analytics)

## Record (`place.stream.segment`)

Type: record · key tid

### Properties

- `audio` (array)
  - `items` (ref)
    - Reference: `#audio`
- `contentRights` (ref)
  - Reference: `place.stream.metadata.contentRights`
- `contentWarnings` (ref)
  - Reference: `place.stream.metadata.contentWarnings`
- `creator` (string · did, required)
- `distributionPolicy` (ref)
  - Reference: `place.stream.metadata.distributionPolicy`
- `duration` (integer): The duration of the segment in nanoseconds
- `id` (string, required): Unique identifier for the segment
- `signingKey` (string, required): The DID of the signing key used for this segment
- `size` (integer): The size of the segment in bytes
- `startTime` (string · datetime, required): When this segment started
- `video` (array)
  - `items` (ref)
    - Reference: `#video`

## #audio (`place.stream.segment#audio`)

Type: object

### Properties

- `channels` (integer, required)
- `codec` (string, required)
  - Constraints: enum: opus | aac
- `rate` (integer, required)

## #framerate (`place.stream.segment#framerate`)

Type: object

### Properties

- `den` (integer, required)
- `num` (integer, required)

## #segmentView (`place.stream.segment#segmentView`)

Type: object

### Properties

- `cid` (string · cid, required)
- `record` (unknown, required)

## #video (`place.stream.segment#video`)

Type: object

### Properties

- `bframes` (boolean)
- `codec` (string, required)
  - Constraints: enum: h264
- `framerate` (ref)
  - Reference: `#framerate`
- `height` (integer, required)
- `width` (integer, required)

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "audio": {
      "properties": {
        "channels": {
          "type": "integer"
        },
        "codec": {
          "enum": [
            "opus",
            "aac"
          ],
          "type": "string"
        },
        "rate": {
          "type": "integer"
        }
      },
      "required": [
        "codec",
        "rate",
        "channels"
      ],
      "type": "object"
    },
    "framerate": {
      "properties": {
        "den": {
          "type": "integer"
        },
        "num": {
          "type": "integer"
        }
      },
      "required": [
        "num",
        "den"
      ],
      "type": "object"
    },
    "main": {
      "description": "Media file representing a segment of a livestream",
      "key": "tid",
      "record": {
        "properties": {
          "audio": {
            "items": {
              "ref": "#audio",
              "type": "ref"
            },
            "type": "array"
          },
          "contentRights": {
            "ref": "place.stream.metadata.contentRights",
            "type": "ref"
          },
          "contentWarnings": {
            "ref": "place.stream.metadata.contentWarnings",
            "type": "ref"
          },
          "creator": {
            "format": "did",
            "type": "string"
          },
          "distributionPolicy": {
            "ref": "place.stream.metadata.distributionPolicy",
            "type": "ref"
          },
          "duration": {
            "description": "The duration of the segment in nanoseconds",
            "type": "integer"
          },
          "id": {
            "description": "Unique identifier for the segment",
            "type": "string"
          },
          "signingKey": {
            "description": "The DID of the signing key used for this segment",
            "type": "string"
          },
          "size": {
            "description": "The size of the segment in bytes",
            "type": "integer"
          },
          "startTime": {
            "description": "When this segment started",
            "format": "datetime",
            "type": "string"
          },
          "video": {
            "items": {
              "ref": "#video",
              "type": "ref"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "signingKey",
          "startTime",
          "creator"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "segmentView": {
      "properties": {
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "record": {
          "type": "unknown"
        }
      },
      "required": [
        "cid",
        "record"
      ],
      "type": "object"
    },
    "video": {
      "properties": {
        "bframes": {
          "type": "boolean"
        },
        "codec": {
          "enum": [
            "h264"
          ],
          "type": "string"
        },
        "framerate": {
          "ref": "#framerate",
          "type": "ref"
        },
        "height": {
          "type": "integer"
        },
        "width": {
          "type": "integer"
        }
      },
      "required": [
        "codec",
        "width",
        "height"
      ],
      "type": "object"
    }
  },
  "id": "place.stream.segment",
  "lexicon": 1
}
```
