How to embed a YouTube Live stream into your website

This is a collection of tips to embed your working YouTube Live stream into your website:

Update: If you have trouble getting the “Embed live streams” feature activated in YouTube, you can try Twitch for live streaming instead. Please see How to stream your IP camera to Twitch


The features “Live streaming” and “Embed live streams” need to be enabled in Please follow the instructions there.

To embed into your website, stream privacy needs to be set to “unlisted” or “public” and a linked AdSense account seems to be required (?).


  1. Open YouTube Studio
  2. Open the stream from the “Manage Tab” on the left
  3. Click Share arrow in the upper right and select embed in the dialog footer to get the embed HTML code, example:

    <iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>

Add this into your website HTML, and open the website in anonymous browser window to check if the stream displays without error message.

Permanent URL

If you only have one stream in your account, we recommend using a permanent URL, so link does not change if you need to recreate the stream.

  1. Get the Channel ID from Not the User ID!

  2. Change the code to use the Channel ID (12345 in this example):

    <iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>

And, there is a permanent link to your live stream (always referencing the first stream in your channel):


How to stream MJPEG to YouTube Live

YouTube Live only allows H.264 encoded video stream for RTMP input. So if you want to stream your (old) IP camera, only supporting MJPEG video streams, you have to transcode your video stream to a format YouTube accepts.

How to stream Mobotix MxPEG to YouTube Live

If your Mobotix camera does not support H.264, you can still use the MxPEG video encoding to have some advantages compared to MJPEG, like lower bandwidth usage and more motion detail.