LiveStreams

A liveStream resource contains information about the video stream that you are transmitting to YouTube. The stream provides the content that will be broadcast to YouTube users. Once created, a liveStream resource can be bound to one or more liveBroadcast resources.

Methods

The API supports the following methods for liveStreams resources:

list
Returns a list of video streams that match the API request parameters. Try it now.
insert
Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience. Try it now.
update
Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings. Try it now.
delete
Deletes a video stream. Try it now.

Resource representation

The following JSON structure shows the format of a liveStreams resource:

{
  "kind": "youtube#liveStream",
  "etag": etag,
  "id": string,
  "snippet": {
    "publishedAt": datetime,
    "channelId": string,
    "title": string,
    "description": string,
    "isDefaultStream": boolean
  },
  "cdn": {
    "ingestionType": string,
    "ingestionInfo": {
      "streamName": string,
      "ingestionAddress": string,
      "backupIngestionAddress": string
    },
    "resolution": string,
    "frameRate": string
  },
  "status": {
    "streamStatus": string,
    "healthStatus": {
      "status": string,
      "lastUpdateTimeSeconds": unsigned long,
      "configurationIssues": [
        {
          "type": string,
          "severity": string,
          "reason": string,
          "description": string
        }
      ]
    }
  },
  "contentDetails": {
    "closedCaptionsIngestionUrl": string,
    "isReusable": boolean
  }
}

Properties

The following table defines the properties that appear in this resource:

Properties
kind string
Identifies the API resource's type. The value will be youtube#liveStream.
etag etag
The Etag of this resource.
id string
The ID that YouTube assigns to uniquely identify the stream.
snippet object
The snippet object contains basic details about the stream, including its channel, title, and description.
snippet.publishedAt datetime
The date and time that the stream was created. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
snippet.channelId string
The ID that YouTube uses to uniquely identify the channel that is transmitting the stream.
snippet.title string
The stream's title. The value must be between 1 and 128 characters long.
snippet.description string
The stream's description. The value cannot be longer than 10000 characters.
snippet.isDefaultStream boolean
This property will be deprecated on or after September 1, 2020. At that time, YouTube will stop creating a default stream and default broadcast when a channel is enabled for live streaming. Please see the deprecation announcement for more details.
This property indicates whether this stream is the default stream for the channel.

How default streams work

When a YouTube channel is enabled for live streaming, YouTube creates a default stream and a default broadcast for the channel. The stream defines how the channel owner sends live video to YouTube, and the broadcast is how viewers can see the default stream. A channel owner can use the liveStreams.list and liveBroadcasts.list methods to identify these resources.

A channel's default stream exists indefinitely, does not have a start or end time associated with it, and cannot be deleted. The channel owner needs only to start sending video bits and the stream goes on automatically.

When a stream ends, YouTube converts the completed broadcast to a YouTube video and assigns the video a YouTube video ID. After the conversion is complete, the video is included in the channel's list of uploaded videos. The video is not available immediately after the broadcast concludes, and the length of the delay is related to the actual length of the broadcast.
cdn object
The cdn object defines the live stream's content delivery network (CDN) settings. These settings provide details about the manner in which you stream your content to YouTube.
cdn.format string
This property has been deprecated since April 18, 2016, and will no longer be supported as of August 17, 2020. Requests that still use this property as of that date will fail.

Instead, use the cdn.frameRate and cdn.resolution properties to specify the frame rate and resolution separately.
cdn.ingestionType string
The method or protocol used to transmit the video stream.

Valid values for this property are:
  • dash
  • hls
  • rtmp (which includes RTMPS)
cdn.ingestionInfo object
The ingestionInfo object contains information that YouTube provides that you need to transmit your stream to YouTube.
cdn.ingestionInfo.streamName string
The stream name that YouTube assigns to the video stream.
cdn.ingestionInfo.ingestionAddress string
The primary ingestion URL that you should use to stream video to YouTube if you use RTMP, DASH, or HLS. You must stream video to this URL.

Depending on which application or tool you use to encode your video stream, you may need to enter the stream URL and stream name separately or you may need to concatenate them in the following format:
STREAM_URL/STREAM_NAME
cdn.ingestionInfo.backupIngestionAddress string
The backup ingestion URL that you should use to stream video to YouTube if you use RTMP, DASH, or HLS. You have the option of simultaneously streaming the content that you are sending to the ingestionAddress to this URL.
cdn.ingestionInfo.rtmpsIngestionAddress string
The primary ingestion URL that you should use to stream video to YouTube if you use RTMPS. You must stream video to this URL.

Depending on which application or tool you use to encode your video stream, you may need to enter the stream URL and stream name separately or you may need to concatenate them in the following format:
STREAM_URL/STREAM_NAME
cdn.ingestionInfo.rtmpsBackupIngestionAddress string
The backup ingestion URL that you should use to stream video to YouTube if you use RTMPS.
cdn.resolution string
The resolution of the inbound video data.

Valid values for this property are:
  • 240p
  • 360p
  • 480p
  • 720p
  • 1080p
  • 1440p
  • 2160p
  • variable: Use this setting to indicate that YouTube should automatically detect the resolution of your streamed video. You must also set cdn.frameRate to variable.
    See the YouTube Help Center for recommended encoder settings.
cdn.frameRate string
The frame rate of the inbound video data.

Valid values for this property are:
  • 30fps
  • 60fps
  • variable: Use this setting to indicate that YouTube should automatically detect the frame rate of your streamed video. You must also set cdn.resolution to variable.
    See the YouTube Help Center for recommended encoder settings.
status object
The status object contains information about live stream's status.
status.streamStatus string
The stream's status.

Valid values for this property are:
  • active – The stream is in active state which means the user is receiving data via the stream.
  • created – The stream has been created but does not have valid CDN settings.
  • error – An error condition exists on the stream.
  • inactive – The stream is in inactive state which means the user is not receiving data via the stream.
  • ready – The stream has valid CDN settings.
status.healthStatus object
This object contains information about the live stream's health status, which could be used to identify, diagnose, and resolve streaming problems.
status.healthStatus.status string
The status code of this stream.

Valid values for this property are:
  • good – There are no configuration issues for which the severity is warning or worse.
  • ok – There are no configuration issues for which the severity is error.
  • bad – The stream has some issues for which the severity is error.
  • noData – YouTube's live streaming backend servers do not have any information about the stream's health status.
status.healthStatus.lastUpdateTimeSeconds unsigned long
The last time that the stream's health status was updated. The value reflects a UNIX timestamp in seconds.
status.healthStatus.configurationIssues[] list
This object contains a list of configuration issues affecting the stream.
status.healthStatus.configurationIssues[].type string
Identifies the type of error affecting the stream.
Configuration issues
audioBitrateHigh
Reason:Check audio settings
Description:The audio stream's current bitrate of %(actual) is higher than the recommended bitrate. We recommend that you use an audio stream bitrate of %(expected)s.
audioBitrateLow
Reason:Check audio settings
Description:The audio stream's current bitrate (%(actual)s) is lower than the recommended bitrate. We recommend that you use an audio stream bitrate of %(expected)s.
audioBitrateMismatch
Reason:Check secondary stream
Description:In the current configuration, the video's primary and backup streams have different audio bitrates. You need to configure the streams to have the same audio bitrate.
audioCodec
Reason:Check audio settings
Description:The audio stream is encoded with an unsupported codec. Please set the audio codec for the stream to a supported codec (AAC, MP3).
audioCodecMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams use different audio codecs. You need to configure the streams to use the same audio codec.
audioSampleRate
Reason:Check audio settings
Description:The current sample rate is %(actual). The recommended sample rates are 44.1kHz and 48kHz.
audioSampleRateMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams have different audio sample rates. You need to configure the streams to have the same audio sample rate.
audioStereoMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams use different audio channels. You need to configure the streams to have the same audio channel.
audioTooManyChannels
Reason:Check audio settings
Description:The audio has more than two channels, but only one (mono) or two (stereo) channels are supported. Please correct the number of audio channels.
badContainer
Reason:Bad video settings
Description:Please change the video's container format. The current container format is not correct for this configuration.
bitrateHigh
Reason:Check video settings
Description:The stream's current bitrate (%(actual)s) is higher than the recommended bitrate. We recommend that you use a stream bitrate of %(expected)s.
bitrateLow
Reason:Video output low
Description:The stream's current bitrate (%(actual)s) is lower than the recommended bitrate. We recommend that you use a stream bitrate of %(expected)s.
framerateMismatch
Reason:Check secondary stream
Description:In the current configuration, the video's primary and backup streams have different framerates. You need to configure the streams to have the same framerate.
frameRateHigh
Reason:Framerate high
Description:The current framerate is too high. Please set the framerate to %(framerate)s fps or less.
gopMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams have different keyframe frequencies. You need to configure the streams to have the same keyframe frequency.
gopSizeLong
Reason:Bad video settings
Description:Please use a keyframe frequency of four seconds or less. Currently, keyframes are not being sent often enough, which will cause buffering. The current keyframe frequency is %(actual_gop).1f seconds. Note that ingestion errors can cause incorrect GOP (group of pictures) sizes.
gopSizeOver
Reason:Check video settings
Description:Please use a keyframe frequency of four seconds or less. Currently, keyframes are not being sent often enough, which can cause buffering. The current keyframe frequency is %(actual_gop).1f seconds. Note that ingestion errors can cause incorrect GOP (group of pictures) sizes.
gopSizeShort
Reason:Check video settings
Description:The GOP (group of pictures) size is very small, which can reduce image quality. The recommended keyframe frequency is four seconds. The current keyframe frequency is %(actual_gop).1f seconds. Note that ingestion errors can cause incorrect GOP sizes.
multipleAudioStreams
Reason:Check audio settings
Description:The ingestion stream contains multiple audio streams, but it must only contain one audio stream.
multipleVideoStreams
Reason:Bad video settings
Description:The ingestion stream contains multiple video streams, but it must only contain one video stream.
noAudioStream
Reason:No audio
Description:The ingestion stream does not contain any audio streams, but it must contain exactly one audio stream.
noVideoStream
Reason:No video
Description:The ingestion stream does not contain any video streams, but it must contain exactly one video stream.
openGop
Reason:Bad video settings
Description:Please change your video encoder's configuration to "closed group of pictures (GOP)." It appears to be set to "open GOP," which YouTube does not support.
resolutionMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams have different resolutions. You need to configure the streams to have the same resolution.
videoBitrateMismatch
Reason:Check secondary stream
Description:In the current configuration, the video's primary and backup streams have different video bitrates. You need to configure the streams to have the same video bitrate.
videoCodec
Reason:Bad video settings
Description:The video is encoded with an unsupported codec. Please set the video codec for the stream to a supported codec (H.264).
videoCodecMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams use different video codecs. You need to configure the streams to have the same video codecs.
videoIngestionStarved
Reason:Video output low
Description:YouTube is not receiving enough video to maintain smooth streaming. As such, viewers will experience buffering.
videoInterlaceMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams have different interlacing. You need to configure the streams to have the same interlacing.
videoProfileMismatch
Reason:Bad secondary stream
Description:In the current configuration, the video's primary and backup streams have different profiles. You need to configure the streams to have the same profile.
videoResolutionSuboptimal
Reason:Check resolution
Description:Please check the video resolution. The current resolution is (%(actual_w)dx%(actual_h)d), which is not optimal.
videoResolutionUnsupported
Reason:Unsupported resolution
Description:You need to change the video resolution. The current resolution is (%(actual_w)dx%(actual_h)d), which is not supported for this configuration. The expected video resolution is (%(expected_w)dx%(expected_h)d).
status.healthStatus.configurationIssues[].severity string
Indicates how severe the issue is to the stream.

Valid values for this property are:
  • info – The video is broadcast to viewers with no adverse effect on performance.
  • warning – The video is broadcast to viewers, but performance is not optimal.
  • error – The video cannot be broadcast to viewers.
status.healthStatus.configurationIssues[].reason string
A short description of the issue. The Configuration Issues for LiveStream Resources document identifies the reason associated with each configuration issue type.
status.healthStatus.configurationIssues[].description string
A detailed description of the issue. When possible, the description provides information about how to resolve the issue. The Configuration Issues for LiveStream Resources document lists all of the configuration issue types and their associated descriptions.
contentDetails object
The content_details object contains information about the stream, including the closed captions ingestion URL.
contentDetails.closedCaptionsIngestionUrl string
The ingestion URL where the closed captions of this stream are sent.
contentDetails.isReusable boolean
Indicates whether the stream is reusable, which means that it can be bound to multiple broadcasts. It is common for broadcasters to reuse the same stream for many different broadcasts if those broadcasts occur at different times.

If you set this value to false, then the stream will not be reusable, which means that it can only be bound to one broadcast. Non-reusable streams differ from reusable streams in the following ways:
  • A non-reusable stream can only be bound to one broadcast.
  • A non-reusable stream might be deleted by an automated process after the broadcast ends.
  • The liveStreams.list method does not list non-reusable streams if you call the method and set the mine parameter to true. The only way to use that method to retrieve the resource for a non-reusable stream is to use the id parameter to identify the stream.