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.
First time live streaming? You will need software to send your video to Cloudflare. Learn how to go live on Stream using OBS Studio.
Step 1: Create a live input via the Stream Dashboard ↗.
Step 2: Copy the RTMPS URL and key, and use them with your live streaming application. We recommend using Open Broadcaster Software (OBS) ↗ to get started.
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.
To start a live stream programmatically, make a POST
request to the /live_inputs
endpoint:
API Reference Docs for /live_inputs
-
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 toautomatic
.)
- 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
-
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 is1096
.When the stream ends, a
scheduledDeletion
timestamp is calculated using thedeleteRecordingAfterDays
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
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 tooff
, and the input will not be recorded or available for playback.
- When the mode property is set to
-
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.
- The
-
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.
- The
-
hideLiveViewerCount
boolean default:false
- Restrict access to the live viewer count and remove the value from the player.
You can update live inputs by making a PUT
request:
Delete a live input by making a DELETE
request:
- 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 ↗ (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.
- 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.
- 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 ↗.
- 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.
- 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.