YouTube Setup

Creating a YouTube Account

If you don’t already have a YouTube account, you’ll need to create one to develop with the Genvid SDK for the YouTube service.

The simplest way to create a new YouTube account is to visit https://www.youtube.com/ and click the Sign In button in the top right corner.

Follow these steps and you should have a YouTube account in no time.

Creating a YouTube Streaming Channel

Once your account is created and verified, you will need to define a few parameters used for live streaming. To do so, go to https://www.youtube.com/live_dashboard and fill in the information in the required fields.

Now you will need to enable your channel for live streaming.

  1. From the top right, click Create (upper right corner).
  2. Select Go live.
  3. Click on Get Started to enable live streaming.

Note

YouTube requires 24h to activate a new live account. Once activated, you will be able to start live streaming.

Configuring Live Streaming

Warning

We noted that the YouTube streams may fail after 8 hours of consistent streaming. We recommend stream restarts after 8 hour periods.

Do not attempt to perform these steps before your account is verified.

Once your account is created and verified, and the channel is activated, you will need to define a few parameters used for live streaming.

  1. Go to youtube.com
  2. Click on Create in the upper right corner.
  3. Select Go Live.
  4. Select Later date.
  5. Select Streaming software.
  6. Click Stream in the left menu panel.
  7. Enter stream information in the necessary fields.

If you want other people to see your streams, make sure you set your “Privacy” selection to “Public”. If you don’t do so, only you will be able to embed and use your YouTube Live Stream with the Genvid SDK.

  1. Click Save.
  2. In the STREAM SETTINGS section, copy the “Stream URL” value (which should be rtmp://a.rtmp.youtube.com/live2 or something similar), as well as the revealed “Stream key” (which is of the form “xxxx-xxxx-xxxx-xxxx-xxxx”). This last value is critical, as it gives the ability to the Genvid SDK to stream to YouTube.
  3. Copy the value of “Stream URL” in the settings.encode.stream.addr field of your configuration file, and the “Stream key” value in the settings.encode.stream.key field.

In addition to the addr and key fields, Genvid also requires a channel field corresponding to your YouTube Channel ID. To retrieve it, go to https://www.youtube.com/account_advanced and copy the YouTube Channel ID value (in the form XXXXXXXXXXXXXXXXXXXXXXXX) settings.encode.stream.channel field of your configuration file.

See the Settings example below.

Optional Low Latency Option

YouTube allows to optimize the stream for either less viewer buffering (which is the default) or for lower latencies.

Should you prefer to lower the latency (our experience shows a latency of about 10-15 seconds), you can do so by selecting the Stream latency option of your choice in the STREAM SETTINGS (below the Stream key section).

Settings

Warning

The YouTube configuration now needs a Video ID instead of a channel name.

The YouTube configuration file requires the Video ID and a Stream Key. To get your Video ID:

  1. Go to your YouTube channel home page.

  2. Click Create ‣ Go live to open the YouTube studio tab.

  3. Copy your Video ID from the YouTube studio page’s URL.

https://studio.youtube.com/video/[YOUR VIDEO ID]/livestreaming

You can also get your Stream Key from the same YouTube studio tab.

Once you have all the information above, you can edit your configuration file. The result should be set to the following:

version = "1.7.0"

settings {
  encode {
    stream {
      enable  = true
      service = "youtube"
      addr    = "rtmp://a.rtmp.youtube.com/live2"
      // YOU MUST CHANGE THE VIDEO ID AND KEY VALUES
      videoid = ""
      key     = ""
    }
  }
  leaf {
    port = 30001
  }
}

link "button" {
  name     = "Youtube Video"
  template = "https://www.youtube.com/watch?v=${key `genvid/encode/stream/videoid`}"
}

config {
  embed_ssl {
    enabled = false
  }
} // end of config

If you want to stream using SSL, just make sure to set embed_ssl to true. Once you load your configuration file, a new button YOUTUBE CHANNEL will appear that will redirect you to your stream on YouTube’s website. To test the embedded stream on the website, click on CUBE SAMPLE

Warning

Whether you’re using SSL on a cloud or a local cluster, if you load youtube.sample.hcl before loading the web sample, the web sample will overwrite the value associated with the embed_ssl from the web.hcl file.