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, a linked AdSense account seems to be required.

Also refer to:


  • Set the stream to unlisted or public
  • Go to the “Watch page” (View on watch page link (lower right) in
  • Click Share -> Embed to get the embed HTML code


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

Now the problem is: every time the stream stops and restarts, the ID changes.

To get a permanent URL, you need to change the link to use the Channel ID (12345 in this example):

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

Get the Channel ID from Not the User ID!

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

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.