Skip to content
webcam.io

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.

This short tutorial shows how to use our live streaming plan to accomplish this.

Requires a webcam.io account. Sign up for the free 7-day trial to try out all features.

Update: with recent YouTube interface changes, we recommend using “Scheduled Streams” over “Stream Now”/“Stream”, to allow stream reconnects and allow 24/7 streaming. Also see Using YouTube Live.

Step 1 – Set up the camera

The example camera here is a Trendnet TV-IP200, around 12 years old and still called Network Camera Server in the product description :-)

The video URL is found quickly by using google with the camera model and “video URL”. For the local network it can be tested via VLC (File… Open Network)

http://USER:PW@192.168.1.1/video.cgi
    

Securing the camera is important, as it needs to be available from the outside. To protect the admin user, please add another user in the camera menu and disable the guest user, if it exists.

Image quality is also an important issue, because it has to be in balance with the available upstream bandwidth. MJPEG needs a lot of bandwidth, so we have to reduce to 1 frame per second here to get the maximum single image quality (Image compression set to ‘Very low’).

From the camera menu:

image quality

After a successful test, port forwarding needs to be set in the router. This maps a port from “the outside” to a device in the inner network.

(If your camera supports this, use another port than the camera web interface. Or the RTSP port 554. This improves security a bit.)

Port forwarding setup might look like this:

port forwarding example

If you don’t have a static IP address for your internet connection, you also need to set up dynamic dns in your router. There are a lot of great tutorials out there.

The camera should be available from the outside now. If your router supports it, you can check the stream with the full URL from the inside:

http://USER:PW@DYNDNS-NAME:8853/video.cgi

Step 2 – Set up YouTube Stream Now

The Stream Now feature of YouTube can be used for testing and production usage. It will detect the stream parameters automatically.

To setup the stream, go to the Creator Studio by clicking on the profile in the upper right corner (things might be different for your YouTube account).

Then open Streaming -> Stream Now in the left navigation bar:

stream now

The interesting part is the Server URL and the Stream key - we will need it in the next step:

stream key

And you might want to set the stream to unlisted/private for testing.

Step 3 – Set up webcam.io and start streaming

Head over to webcam.io and add a new webcam of type ‘Live stream’:

webcam.io streaming

Fill in the streaming URL of your camera (from step 1) into the Input section and the YouTube stream target URL from step 2 into Output

Input type is MJPEG.

Transcoding is required for MJPEG and the very low framerate. We select the “720 / 5 fps” setting here.

(Transcoding puts more load on our servers and requires the LIVE+ plan. If you only have a very low resolution/bitrate camera, please contact us. We will discount the LIVE+ plan!)

By saving the webcam settings (with Enable streaming checkbox activated), streaming will start within the next 30-60 seconds. The stream status is visible in the status box in your dashboard:

webcam.io streaming

On the YouTube Stream Now page, status should change after a few minutes and then the live player shows the video stream.

To see if it is stable, just leave the page open for 10-30 minutes and watch the Stream health status.

If everything is fine, you have a working live stream now!

Please contact us if you need help with a not starting stream or finding the video stream URL of your camera. Also see FAQ.