Streaming RTSP to YouTube Live
I have wanted to stream the camera feeds from the cameras overlooking Picton and Waikawa since I installed them. At the time there was no easy way to do this without paying for a streaming service that would convert and host the stream for you. Now we have YouTube Live. A free host for RTMP streams. There are a few challenges that I had to overcome related to my system. For example:
I will quickly start with the easy ones.
I reduce the bandwidth and data usage over the course of a day in three different ways:
Converting RTSP to RTMP with FFMPEG
To create compatible stream formats we capture the RTSP stream and convert it into RTMP with the help of a (in my case Windows) server running ffmpeg. The following example is the command I use for my cameras. You might have to check how to capture your RTSP stream. (I purposely don't stream audio captured by the camera.)
A few notes:
Setting up YouTube Live
Follow the instructions here. After you're done, set up a live stream, giving it a title and a description and near the bottom of the page under "ENCODER SETUP", copy the "Stream name/key" and paste it in the ffmpeg command.
Optional - Schedule Automatic Start Time
As stated before I only stream between certain hours. As you have seen earlier in the blog post I give a duration that the stream is going to be online for. But we also need a way to start it. Because I run it on a Windows server I create a .bat file and use "Task Scheduler" to run it.
The batch file only contains the following three lines:
Actually I have a "PAUSE" commented out in case you want to debug.
To create an automated task use windows search to find "Task Scheduler".
This is missing some information but since everybody their equipment is most likely slightly different and so will be there requirements I decided to give enough info to get you started. You might have to do some research on which changes to make to make it work for you. Off course you want to see some examples.
Update: Stream links have been removed since I don't use RTSP with my latest cameras anymore. The instructions should still give you a good starting point for getting your own stream going.
George Timmermans, Research Toolmaker, Software Engineer and Tinkerer