Live stream from a USB webcam with your Raspberry Pi to Youtube
With this dockerized app, you can use a webcam to stream live video to YouTube
It was developer for Raspberry Pi, but of course it works with any type of HW as long as it supports Docker.
Docker
curl -sSL https://get.docker.com | sh
docker-compose
sudo pip install docker-compose
OR sudo pip3 install docker-compose
git clone https://github.com/gaborvecsei/YouTube-Live-Stream-Docker.git
cd Youtube-Live-Stream-Docker
With this "mode", the streaming starts when your device boots up and shuts down only when you turn off your device or stop the docker container. It can be useful when you have a dedicated device, only for this purpose what your only want to turn on and off without using ssh and entering commands to the terminal. This method handles these automatically.
I use this mode, so I can have a "secret eye" 👀 on my puppy, when I leave ❤️.
cd base_docker_image
then sudo ./build_base.sh
to build the base image for the other Docker imagesdocker-compose.yml
YOUTUBE_LIVE_KEY
to your personal youtube live stream key which you can find at https://www.youtube.com/live_dashboard
devices
change the host mapping if necessary. (By default it uses the video0
).
video1
device than change it to: /dev/video1:/dev/video0
youtube_stream_image
folder and then run command:
sudo docker-compose up -d
youtube_stream_image
folder and then run command:
sudo docker-compose down
As I always forgot to turn on/off the stream, now it does it automatically based on the connected devices on your network ✨.
This is achieved with a MAC whitelist. If a MAC address is in the list, that means if it's present at your network, the stream will shut down automatically (so you don't have to worry about being streamed, even if it's private). If it's not present then the stream goes live.
+---------------------------+
| +
| yes+---->stop
| ^ stream
| |
v +
start +-----> scan devices +---> is whitelisted MAC
^ present?
| +
| |
| v
| no+----->start
| stream
| +
+---------------------------+
master_app_image/code/whitelisted_devices.csv
arp-scan
or nmap
we know, we can shut down the streamprivate
at YouTube Live Dashboard
sudo docker-compose up -d
(For logs you can use sudo docker-compose logs
or inside the code
folders you can find the log files)
sudo docker-compose down
GET, POST - localhost:8887/device_scan_api/scan
result: {"device_macs": ["00:11:22:33:44:55", ...}
GET, POST - localhost:8888/youtube_stream_api/start
GET, POST - localhost:8888/youtube_stream_api/stop
GET, POST - localhost:8888/youtube_stream_api/check_health
GET, POST - localhost:8888/youtube_stream_api/alive
csv
for whitelistingGbor Vecsei