---
title: Start a live stream
description: Create live inputs and broadcast live video to Cloudflare Stream using RTMPS or SRT.
image: https://developers.cloudflare.com/dev-products-preview.png
---

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

[Skip to content](#%5Ftop) 

# Start a live stream

After you subscribe to Stream, you can create Live Inputs in Dash or via the API. Broadcast to your new Live Input using RTMPS or SRT. SRT supports newer video codecs and makes using accessibility features, such as captions and multiple audio tracks, easier.

Note

Stream only supports the SRT caller mode, which is responsible for broadcasting a live stream after a connection is established.

**First time live streaming?** You will need software to send your video to Cloudflare. [Learn how to go live on Stream using OBS Studio](https://developers.cloudflare.com/stream/examples/obs-from-scratch/).

## Use the dashboard

**Step 1:** In the Cloudflare dashboard, go to the **Live inputs** page and create a live input.

[ Go to **Live inputs** ](https://dash.cloudflare.com/?to=/:account/stream/inputs) ![Create live input field from dashboard](https://developers.cloudflare.com/_astro/create-live-input-from-stream-dashboard.BPPM6pVj_Pmc3d.webp) 

**Step 2:** Copy the RTMPS URL and key, and use them with your live streaming application. We recommend using [Open Broadcaster Software (OBS) ↗](https://obsproject.com/) to get started.

![Example of RTMPS URL field](https://developers.cloudflare.com/_astro/copy-rtmps-url-from-stream-dashboard.BV1iePso_Z1ouwlP.webp) 

**Step 3:** Go live and preview your live stream in the Stream Dashboard

In the Stream Dashboard, within seconds of going live, you will see a preview of what your viewers will see. To add live video playback to your website or app, refer to [Play videos](https://developers.cloudflare.com/stream/viewing-videos).

## Use the API

To start a live stream programmatically, make a `POST` request to the `/live_inputs` endpoint:

Request

```

curl -X POST \

--header "Authorization: Bearer <API_TOKEN>" \

--data '{"meta": {"name":"test stream"},"recording": { "mode": "automatic" }}' \

https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/live_inputs


```

Response

```

{

  "uid": "f256e6ea9341d51eea64c9454659e576",

  "rtmps": {

    "url": "rtmps://live.cloudflare.com:443/live/",

    "streamKey": "MTQ0MTcjM3MjI1NDE3ODIyNTI1MjYyMjE4NTI2ODI1NDcxMzUyMzcf256e6ea9351d51eea64c9454659e576"

  },

  "created": "2021-09-23T05:05:53.451415Z",

  "modified": "2021-09-23T05:05:53.451415Z",

  "meta": {

    "name": "test stream"

  },

  "status": null,

  "recording": {

    "mode": "automatic",

    "requireSignedURLs": false,

    "allowedOrigins": null,

    "hideLiveViewerCount": false

  },

  "enabled": true,

  "deleteRecordingAfterDays": null,

  "preferLowLatency": false

}


```

#### Optional API parameters

[API Reference Docs for /live\_inputs](https://developers.cloudflare.com/api/resources/stream/subresources/live%5Finputs/methods/create/)

* `enabled` boolean default: `true`  
   * Controls whether the live input accepts incoming broadcasts. When set to `false`, the live input will reject any incoming RTMPS or SRT connections. Use this property to programmatically end creator broadcasts or prevent new broadcasts from starting on a specific input.
* `preferLowLatency` boolean default: `false` Beta  
   * When set to true, this live input will be enabled for the beta Low-Latency HLS pipeline. The Stream built-in player will automatically use LL-HLS when possible. (Recording `mode` property must also be set to `automatic`.)
* `deleteRecordingAfterDays` integer default: `null` (any)  
   * Specifies a date and time when the recording, not the input, will be deleted. This property applies from the time the recording is made available and ready to stream. After the recording is deleted, it is no longer viewable and no longer counts towards storage for billing. Minimum value is `30`, maximum value is `1096`.  
   When the stream ends, a `scheduledDeletion` timestamp is calculated using the `deleteRecordingAfterDays` value if present.  
   Note that if the value is added to a live input while a stream is live, the property will only apply to future streams.
* `timeoutSeconds` integer default: `0`  
   * The `timeoutSeconds` property specifies how long a live feed can be disconnected before it results in a new video being created.

The following four properties are nested under the `recording` object.

* `mode` string default: `off`  
   * When the mode property is set to `automatic`, the live stream will be automatically available for viewing using HLS/DASH. In addition, the live stream will be automatically recorded for later replays. By default, recording mode is set to `off`, and the input will not be recorded or available for playback.
* `requireSignedURLs` boolean default: `false`  
   * The `requireSignedURLs` property indicates if signed URLs are required to view the video. This setting is applied by default to all videos recorded from the input. In addition, if viewing a video via the live input ID, this field takes effect over any video-level settings.
* `allowedOrigins` integer default: `null` (any)  
   * The `allowedOrigins` property can optionally be invoked to provide a list of allowed origins. This setting is applied by default to all videos recorded from the input. In addition, if viewing a video via the live input ID, this field takes effect over any video-level settings.
* `hideLiveViewerCount` boolean default: `false`  
   * Restrict access to the live viewer count and remove the value from the player.

## Manage live inputs

You can update live inputs by making a `PUT` request:

Request

```

curl --request PUT \

https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/live_inputs/{input_id} \

--header "Authorization: Bearer <API_TOKEN>" \

--data '{"meta": {"name":"test stream 1"},"recording": { "mode": "automatic", "timeoutSeconds": 10 }}'


```

Delete a live input by making a `DELETE` request:

Request

```

curl --request DELETE \

https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/live_inputs/{input_id} \

--header "Authorization: Bearer <API_TOKEN>"


```

## Recommendations, requirements and limitations

If you are experiencing buffering, freezing, experiencing latency, or having other similar issues, visit [live stream troubleshooting](https://developers.cloudflare.com/stream/stream-live/troubleshooting/).

### Recommendations

* Your creators should use an appropriate bitrate for their live streams, typically well under 12Mbps (12000Kbps). High motion, high frame rate content typically should use a higher bitrate, while low motion content like slide presentations should use a lower bitrate.
* Your creators should use a [GOP duration ↗](https://en.wikipedia.org/wiki/Group%5Fof%5Fpictures) (keyframe interval) of between 2 to 8 seconds. The default in most encoding software and hardware, including Open Broadcaster Software (OBS), is within this range. Setting a lower GOP duration will reduce latency for viewers, while also reducing encoding efficiency. Setting a higher GOP duration will improve encoding efficiency, while increasing latency for viewers. This is a tradeoff inherent to video encoding, and not a limitation of Cloudflare Stream.
* When possible, select CBR (constant bitrate) instead of VBR (variable bitrate) as CBR helps to ensure a stable streaming experience while preventing buffering and interruptions.

#### Low-Latency HLS broadcast recommendations Beta

* For lowest latency, use a GOP size (keyframe interval) of 1 or 2 seconds.
* Broadcast to the RTMP endpoint if possible.
* If using OBS, select the "ultra low" latency profile.

### Requirements

* Closed GOPs are required. This means that if there are any B frames in the video, they should always refer to frames within the same GOP. This setting is the default in most encoding software and hardware, including [OBS Studio ↗](https://obsproject.com/).
* Stream Live only supports H.264 video and AAC audio codecs as inputs. This requirement does not apply to inputs that are relayed to Stream Connect outputs. Stream Live supports ADTS but does not presently support LATM.
* Clients must be configured to reconnect when a disconnection occurs. Stream Live is designed to handle reconnection gracefully by continuing the live stream.

### Limitations

* Watermarks cannot yet be used with live videos.
* If a live video exceeds seven days in length, the recording will be truncated to seven days. Only the first seven days of live video content will be recorded.

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/stream/","name":"Stream"}},{"@type":"ListItem","position":3,"item":{"@id":"/stream/stream-live/","name":"Stream live video"}},{"@type":"ListItem","position":4,"item":{"@id":"/stream/stream-live/start-stream-live/","name":"Start a live stream"}}]}
```
