How to stream an IP camera using “Youtube live”
What you need:
- one or more ip cameras
- a video encoder – I will use a free Linux encoder called OBS. I also believe it is available in Windows format
- a website (optional) where you can publish/embed the YouTube stream
Generally speaking you will capture the stream at your location from one or more cameras (encode the stream(s)) and push them to YouTube where they can be viewed at the YouTube site or you can embed the stream in your own website/webpage.
In the following image you will note that there are two “Scenes”: “Scene” and “birdfeeder” this was done earlier so that I could define my own “Custom Streaming Server”. Just ignore them.
Now however we are going to use a preset: “YouTube”.
We will add a new “Scene”: bf2 and a new “Sources”: “Media Sources2” as shown below.
Note in the above pic that “Local File” is unchecked. Also the “Input” line and “Input Format” line are camera dependent. For my camera it would be:
Input Format: rtsp
You need to check with your camera’s documentation to determine how to fill these two fields.
Also note in the above the “Use hardware decoding when available” checkbox. Do not check this box. Why? because your YoutTube stream will have a “green” status but there will be no Motion in your YouTube video.
This will then produce the following image:
Go to “OBS settings -> Stream and fill in according to the image below:
Please note the “Stream Key” value. You obtain this from your YouTube account and it is important that you keep it private.
go to “OBS” -> Tools ->” Auto configuration Wizard” -> “Optimize for streaming” -> Next (you might get a “base canvas warning” (read it) – Next -> “Final results” -> “Apply Settings” Done. Using this beta Auto Configuration Wizard is a good place to start if your new to this like I am. You can alway go back in later and modify these settings.
Now go to your YouTube account -> “Creator Studio” -> “Basic Info” (here is where you stream key will be).
On this YouTube page you should see “status” on your live stream. Probably “off line”. Back in OBS “Start Streaming” and your live stream should begin. It will indicate green, organge, or red.
If you have a small image in the YouTube window then you need to revisit OBS and make adjustments through that application.
- If your YouTube stream status is green or orange and there is no “motion” click on the little “gear” below the “Source that you are using and be sure that the “Use hardware decoding….” check box is NOT checked. Checking this box will give the appearance that all is well but there will be no motion.
- Video is choppy.
- lower your bit rate
- adjust frame rate
- Slow upload speeds provided by your ISP.
- an example. Run a speed test on your network connection using one of the many speed test sites. Lets say that you get an upload speed of 4.09. Perform the following calculation.
(upload_speed * 1000) * 80% i.e. (4.09 *1000) * 80% = 3272 . Use the 3272 value in OBS -> settings -> output -> advanced -> bitrate and “buffer size” fields. Apply