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 YouTube and click the Sign In button in the top right corner. You’ll need to verify your account before creating your channel.

Warning

Do not attempt to continue with the rest of these steps before your account is verified.

Creating a YouTube Streaming Channel

After you create and verify your YouTube account, you need to activate your channel and enable it for live streaming.

  1. Go to your Live Dashboard.
  2. Fill in all the required information.
  3. Click Create in the upper-right corner.
  4. Select Go live.
  5. Click Get Started to enable live streaming.

Note

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

Configuring Live Streaming

Important

We’ve found that YouTube streams may fail after 8 hours of continuous streaming. We recommend you restart your YouTube stream every 8 hours to avoid this problem.

After activating the channel, you need to define a few parameters used for live streaming.

  1. Go to YouTube.

  2. Click 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 your stream information in the necessary fields.

    Important

    If you want other people to see your streams, make sure you set your Privacy selection to Public. If you don’t, no one but you will be able to embed and use your YouTube live stream with the Genvid SDK.

  8. Click Save.

  9. In the STREAM SETTINGS section, copy these values to paste in your configuration file:

    • Stream URL Should be similar to rtmp://a.rtmp.youtube.com/live2.

    • Stream Key Should be formatted like xxxx-xxxx-xxxx-xxxx-xxxx.

      Note

      The Stream Key is the value that lets the Genvid SDK stream to YouTube.

  10. Open your configuration file for editing.

  11. Enter the Stream URL for the value of settings.encode.stream.addr.

  12. Enter the Stream Key for the value of settings.encode.stream.key.

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 CHANNEL AND KEY VALUES
      channel = ""
      key     = ""
    }
  }
  leaf {
    port = 30001
  }
}

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

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.