> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Monitor stream health

> Monitor Livepeer livestream ingest health, bitrate, and segment delivery using the Studio API and webhooks.

> [!TIP]
>
> Use webhooks for stream lifecycle events. Poll the stream object for real-time ingest metrics only when you need them -- it is a live read from the transcoder.

***

Stream health monitoring covers two concerns: lifecycle events (is the stream active or idle?) and ingest quality (is the bitrate stable? are segments being delivered?). Use webhooks for the former and API polling for the latter.

Stream Status

## Stream lifecycle

A stream has two observable states:

<table>
  <thead>
    <tr>
      State

      Meaning

      Detection method
    </tr>
  </thead>

  <tbody>
    <tr>
      **active**

      Encoder is pushing video to the RTMP ingest URL

      `stream.started` webhook or `isActive: true` on GET
    </tr>

    <tr>
      **idle**

      No active ingest; stream exists but is not receiving video

      `stream.idle` webhook or `isActive: false` on GET
    </tr>
  </tbody>
</table>

Check status via API:

```typescript theme={null}
const response = await client.stream.get(streamId);
const stream = response.stream;

console.log('Active:', stream.isActive);
console.log('Last seen:', stream.lastSeen); // ISO timestamp
```

Subscribe to lifecycle webhooks for event-driven notifications:

```typescript theme={null}
await client.webhook.create({
  name: 'stream-lifecycle',
  url: 'https://your-server.com/webhooks/stream',
  events: ['stream.started', 'stream.idle'],
});
```

Ingest Metrics

## Ingest health metrics

The stream object includes ingest metrics when the stream is active:

```typescript theme={null}
const response = await client.stream.get(streamId);
const stream = response.stream;

// Available when stream.isActive === true
console.log('Video codec:', stream.videoSpec?.codec);       // e.g. "h264"
console.log('Video bitrate:', stream.videoSpec?.bitrate);   // bits per second
console.log('Frame rate:', stream.videoSpec?.fps);          // frames per second
console.log('Resolution:', `${stream.videoSpec?.width}x${stream.videoSpec?.height}`);
```

Low or unstable `bitrate` values indicate encoder problems (network congestion, CPU throttling, or misconfigured output settings) rather than Livepeer issues.

Health Signals

## Interpreting health signals

| Signal | Healthy range | Action if outside range |
| - | - | - |
| Video bitrate | Within 10% of encoder target | Check encoder network/CPU; reduce output quality |
| Frame rate | Within 2 FPS of encoder target | Check encoder CPU load |
| `isActive` flip to `false` | Should not happen mid-stream | Check encoder network; inspect `stream.idle` webhook payload |

For viewer-side health (buffer length, rebuffering rate), instrument the `@livepeer/react` Player events or integrate your own player analytics.

Alerting

## Setting up alerts

Combine webhooks with your alerting stack (PagerDuty, Grafana, Datadog):

```typescript theme={null}
// Webhook handler -- alert on unexpected stream.idle events
app.post('/webhooks/stream', async (req, res) => {
  const { event, payload } = req.body;

  if (event === 'stream.idle') {
    const stream = payload;
    // Stream went idle -- was this expected?
    if (stream.isScheduled) {
      await alertOncall(`Scheduled stream ${stream.name} went idle unexpectedly`);
    }
  }

  res.sendStatus(200);
});
```

## Related pages

> [card] [Webhooks](/v2/developers/guides/video/webhooks.md)
>
> Full webhook setup and signature verification.

> [card] [Create a Livestream](/v2/developers/guides/video/create-livestream.md)
>
> Stream creation and RTMP ingest configuration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.