Skip to content

A simple shell script for streaming a video feed of an outdoors bird's nest.

Notifications You must be signed in to change notification settings

pinmissile/Birbstream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

BirbStream

A simple shell script for streaming a video feed of an outdoors bird's nest on www.twitch.tv with two cameras - One for day and one for night. The script automatically closes the stream if it loses connection to twitch.tv, restarts upon reconnecting, and will switch between the cameras depending on the local time. (06 - 21 for day, and the rest for night)

Hardware

I used a Raspberry Pi 3 running Raspbian 4.19, a Pi NoIR Camera, and a Logitech C270 USB camera. A case for the Raspberry Pi, as well as an IR spotlight is also recommended.

Software

Setup is fairly straightforward, but since video inputs may from unit to unit, it might be necessairy to do some minor changes in the script to get it to run for you. We're gonna be using FFMpeg to hardware accelerate the webcam footage and stream it. I used this guide by veloc1ty, but I'll go through all the steps here anyway. If you want more details, check out the guide.

Dependencies

Install the required software:

apt-get install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev libomxil-bellagio-dev git

Clone the FFMpeg repo:

git clone https://github.com/ffmpeg/FFMpeg --depth 1

Clone this repo:

git clone https://github.com/pinmissile/Bird-Stream.git

Configuring

Configure the FFMpeg script:

./configure --enable-gpl --enable-nonfree --enable-mmal --enable-omx --enable-omx-rpi

Compile it:

make -j4

Make sure to enable the Raspberry Pi camera by running raspi-config and enabling Camera under Interface.

Create the config file. This is where you put your stream key, which can be found in your Twitch Channel Settings:

cd Bird-Stream/
echo stream_url="rtmp://live.twitch.tv/app/{yourlivekey}" > config.sh

If you don't want to stream on Twitch, you can always switch that out for a different rtmp URL.

How To Run

After installing dependencies and configuring, all you need to do is:

bash stream.sh

Adding a cron job to run the script on boot is recommended in the event of a power outage. If you're having trouble running the NoIR camera, you may have to increase the available memory for the GPU with the command gpu_mem_256.

Known Issues

Currently using h264 encoding to hardware accelerate the NoIR camera, which is very dumb since the framerate ends up being horrible. I unfortunatly didn't really have the motivation to fix that since the bird's nest I streamed got absolutely demolished by a crow.

About

A simple shell script for streaming a video feed of an outdoors bird's nest.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages