George timmermans
  • About Me
    • Resume
    • Press releases
  • Blog
  • Projects
    • Long Range WiFi Link
    • Embedded Systems >
      • Photo Booth
      • Classroom VU meter
      • USB Media Controller
      • Weather Station
      • Arduino Swimming Pool Controller
      • GRBL Android Controller
      • Arduino Serial Driver
      • Arduino Multitasking
      • 8x8x8 LED Cube
      • Analog -> Digital Geiger Counter
    • 3D Printing >
      • Simplify3d Configuration
      • 3D print repairs
    • Home Brewing >
      • Mead Recipes >
        • Cinnamon Mead
        • Sweet Chili Mead
        • Lemon & Ginger Mead
        • Mead Liqueur
        • Honey Beer
      • Glühwein (Spiced Wine)
      • Limoncello
    • House
    • Toolmaking
    • Laser Cutting
  • Weather Cam
  • Contact

Streaming RTSP to YouTube Live

15/6/2016

22 Comments

 
​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:
  • The cameras provide RTSP streams
  • Reduce bandwidth usage because of data cap

I will quickly start with the easy ones. 

Reducing Bandwidth

I reduce the bandwidth and data usage over the course of a day in three different ways:
  • Reduced resolution from 1080p to 720p
  • Reduce 30FPS to 6FPS
  • Run cameras from 7AM to 7PM
The resolution and FPS I configured on the camera to reduce traffic within my network.

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:
  • In this example it's missing a valid camera username, password, IP address and Youtube stream key. I will explain how to get your Youtube stream key further on.
  • In this example you will find the extra argument "-t 12:00:00" This tells it to run for a duration of 12 hours. Remove if you want to stream continuously. 

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".
  • ​Click tab "Action" -> "Create a Basic Task".
  • Give it a name and description. -> :"Next"
  • Trigger "Daily" -> Next
  • Set Start date and Time -> "Next"
  • Select "Start a program" -> "Next"
  • Browse and select your .bat file -> "Next"
  • Click "Finish"
  • Double click your newly created task..
  • Under tap "General" enable "Run Whether user is logged on or not"

Summary

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. 
22 Comments

    Author

    George Timmermans, Research Toolmaker, Software Engineer and Tinkerer

    View my profile on LinkedIn

    Archives

    January 2021
    November 2020
    July 2020
    May 2020
    November 2019
    August 2019
    January 2019
    October 2018
    January 2018
    November 2017
    October 2017
    August 2017
    June 2017
    May 2017
    April 2017
    March 2017
    January 2017
    December 2016
    November 2016
    October 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    December 2015
    November 2015
    October 2015
    September 2015
    August 2015

    Categories

    All
    3d Printing
    Photobooth
    Wisp

    RSS Feed

Proudly powered by Weebly
  • About Me
    • Resume
    • Press releases
  • Blog
  • Projects
    • Long Range WiFi Link
    • Embedded Systems >
      • Photo Booth
      • Classroom VU meter
      • USB Media Controller
      • Weather Station
      • Arduino Swimming Pool Controller
      • GRBL Android Controller
      • Arduino Serial Driver
      • Arduino Multitasking
      • 8x8x8 LED Cube
      • Analog -> Digital Geiger Counter
    • 3D Printing >
      • Simplify3d Configuration
      • 3D print repairs
    • Home Brewing >
      • Mead Recipes >
        • Cinnamon Mead
        • Sweet Chili Mead
        • Lemon & Ginger Mead
        • Mead Liqueur
        • Honey Beer
      • Glühwein (Spiced Wine)
      • Limoncello
    • House
    • Toolmaking
    • Laser Cutting
  • Weather Cam
  • Contact