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. Reducing BandwidthI reduce the bandwidth and data usage over the course of a day in three different ways:
Converting RTSP to RTMP with FFMPEGTo 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 LiveFollow 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 TimeAs 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".
SummaryThis 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
Ironman
6/8/2016 11:14:52 pm
This is a great post! My IP cam is working perfectly.
Reply
Lambert Wixson
14/10/2016 05:02:52 pm
Nice. In my case the RTSP input also contains an audio stream. The -i anullsrc argument you show is necessary but will cause the resulting output to use that empty audio input, Input 0.
Reply
4/4/2017 02:58:19 am
Can you post an example with the audio file. i have no success with my cameras to upload the mic audio.
Reply
autohtoni
14/2/2017 12:14:45 am
How to stream audio too from ip camera ?
Reply
George
14/2/2017 08:55:17 pm
See the comment kindly provided by Lambert Wixson.
Reply
Bob Daly
18/2/2017 07:44:24 am
Hi George,
Reply
George
18/2/2017 07:52:26 am
Hello Bob,
Reply
chris
19/2/2017 12:56:22 pm
Any thoughts on how to add an overlay image to the feed? png, jpeg or gif would be fine
Reply
George
19/2/2017 04:43:08 pm
If it's just a logo and you are streaming to YouTube live use the "add watermark" under the channel tab -> branding in YouTube.
Reply
Алексей
2/3/2017 11:02:20 am
Ты красава Джордж!! Долго искал вменяемые флаги к ffmpeg чтобы отправить поток на Youtube. Огрномное спасибо. Подписался!
Reply
JohnnyBravo
25/4/2017 01:54:03 am
Awesome thanks! Been wanting to do the same thing with my ip cameras I am using Foscam cam that provide only RTSP streams. Can't wait to try this.
Reply
maram
16/5/2017 09:16:05 am
but it is reencoding, why? it same h264
Reply
First of all, thank you George for your generous information and help.
Reply
Ramziddin
5/7/2017 08:21:07 am
Hi George
Reply
George
5/7/2017 08:31:42 am
Hello, for each camera I create a seperate bat file and create a new rule to start the stream.
Reply
Ramziddin
5/7/2017 08:57:15 am
Can they run simultaneously? 12/7/2018 11:02:02 am
Do you have any help available to set up a couple IP cameras on one youtube channel?
Reply
11/11/2018 12:24:28 pm
Thank you for this write-up, I've found it very helpful in automating live IP camera streams to YouTube. I would like to add that if your IP cam doesn't have audio there's no need to create a null audio. To disregard the audio completely use the '-an' flag and also remove everything audio related, like this...
Reply
George
11/11/2018 02:42:10 pm
Thank you, I have updated my instructions following your comment.
Reply
11/11/2018 03:01:00 pm
George, sorry but for some reason I left off the "-an" flag in my above post. 7/8/2020 10:15:05 am
Watch out with the removal the audio track '-an': YouTube don't like streaming without audio track. Your comment will be posted after it is approved.
Leave a Reply. |
AuthorGeorge Timmermans, Research Toolmaker, Software Engineer and Tinkerer Archives
March 2024
Categories |