Live Stream Your Pets with Linux and YouTube!

Anyone who reads Linux Journal knows about my fascination withbirdwatching. I’ve created my own weatherproof video cameras witha Raspberry Pi. I’ve posted instructions on how to create your ownautomatically updating camera image page with JavaScript. Heck, I evenlearned CSS so I could make a mobile-friendly version of BirdCam thatfilled the screen in landscape mode.

Recently, however, I’ve finallybeen able to create an automated system that streams my BirdCam liveover YouTube. It starts when the sun comes up and stops when the sungoes down. And thanks to some powerful open-source software, I neverhave to touch the system!

Some of the tools I describe here have beencovered in other articles, but this is the first time I’ve been able tocreate a stream that anyone can see utilizing bandwidth Google pays for!

Figure 1. Birds are always camera-shy. If you watch long enough, however,they come and steal peanuts!

My List of Ingredients

First off, I want to be clear about what sort of hardware and software isrequired in order to accomplish something similar to what I’m doing:

  • A Linux computer: if you plan to use USB cameras, this needs tobe a physical computer. If your video source is network-based, thiscan be a virtual machine on your network. A Raspberry Pi isn’t reallypowerful enough for the video work that has to be done, unless maybeit’s low-resolution. I have an old i5 CPU running at 1.6GHz, and it’smore than enough.

  • A video source: this can be pretty much any video source you haveat hand. If you plan to use a USB webcam, you’ll need to be sure youare using a physical Linux computer as noted above. I’ve used USB,MJPEG over http (see my old BirdCam articles), cheap wireless securitycameras that have an RTSP stream, and most recently, I started usingUniFi video cameras. In fact, if you are considering purchasing outdoorvideo cameras for a project like this, I can’t recommend UniFi camerasenough. They are PoE, HD and the free software handles recording andprovides RTSP streams that have both HD video and top-notch audio.

  • A YouTube account with Live Streaming enabled: you’ll need to verifyyour account,and then enable livestreaming here.It’s not adifficult process, but without following those steps, you won’t be ableto use the free service.

  • Open Broadcaster Software: I’ve tried multiple ways to use a CLI solutionto stream directly to YouTube with FFmpeg or mencoder, but I’ve never beenable to make it work consistently. I was hesitant to use OBS, because it’s aGUI solution and doesn’t have a CLI interface, but I worked around thatproblem, and I’m actually happy to have the GUI now.

  • A web server to host your embedded channel: you could just share theURL to your YouTube channel, but embedding is much cooler, because youcan integrate it into your own site.

  • Enough upstream bandwidth to support 1.5–2mbps while streaming: sinceYouTube is going to redistribute, the local bandwidth requirementsdon’t change regardless of how many people are watching your stream. Forsome folks (like me, unfortunately), sacrificing that much bandwidth isdifficult and sometimes causes issues. Just know that it takes a small,but not insignificant amount of constant upstream bandwidth to streamlive video. That should be obvious, but it’s something to consider.

  • A few other utilities like crontab and sunwait: the latter is only ifyou want to time your streams with sunrise and sunset. And, crontab isneeded only if you want to automate the starting and stopping. Those touchesreally make a difference for me though, so I encourage you to consider it.



from WordPress http://ift.tt/2hlnAqC
via IFTTT

Σχόλια

Δημοφιλείς αναρτήσεις από αυτό το ιστολόγιο