Last active
May 3, 2025 03:36
-
-
Save mattsn0w/e1ba720b57614f3460c13a20644e6a55 to your computer and use it in GitHub Desktop.
Live Stream to YouTube from Raspberry Pi + camera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3.3' | |
| services: | |
| debian-bullseye: | |
| image: 'debian-bullseye:raspistream' | |
| container_name: stream2youtube | |
| privileged: true | |
| restart: always | |
| volumes: | |
| - '/var/run/docker.sock:/tmp/docker.sock:ro' | |
| - '/dev/:/dev/' | |
| - '/run/udev/:/run/udev/' | |
| - '/run/dbus/:/run/dbus/' | |
| environment: | |
| YTS_KEY: ${YTS_KEY} | |
| logging: | |
| options: | |
| max-size: 10m | |
| devices: | |
| - /dev/vchiq | |
| - /dev/media0 | |
| - /dev/media1 | |
| - /dev/media2 | |
| - /dev/media3 | |
| - /dev/media4 | |
| - '/dev/dma_heap/linux,cma' | |
| - /dev/v4l-subdev0 | |
| - /dev/video0 | |
| - /dev/video10 | |
| - /dev/video11 | |
| - /dev/video12 | |
| - /dev/video13 | |
| - /dev/video14 | |
| - /dev/video15 | |
| - /dev/video16 | |
| - /dev/video17 | |
| - /dev/video18 | |
| - /dev/video19 | |
| - /dev/video20 | |
| - /dev/video21 | |
| - /dev/video22 | |
| - /dev/video23 | |
| - /dev/video24 | |
| - /dev/video31 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM debian:bullseye | |
| RUN apt-get update && \ | |
| apt-get install curl gnupg ca-certificates lsb-release -y && \ | |
| curl -fsSL http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/raspberrypi.gpg && \ | |
| echo "deb http://archive.raspberrypi.org/debian/ bullseye main" > /etc/apt/sources.list.d/raspi.list | |
| RUN apt-get update && \ | |
| apt-get install ffmpeg wireguard libavcodec-extra winff-doc libjpeg-tools libcamera-apps libcamera-tools -y | |
| COPY entrypoint.sh / | |
| ENV YTS_KEY=${YTS_KEY} | |
| ENTRYPOINT ["/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| YTS_KEY= | |
| YTS_URL=rtmp://a.rtmp.youtube.com/live2 | |
| libcamera-vid --inline --nopreview -t 0 --width 1920 --height 1080 --framerate 30 --codec h264 -o - | \ | |
| ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -thread_queue_size 1024 \ | |
| -use_wallclock_as_timestamps 1 -i pipe:0 -c:v copy -c:a aac -preset fast -strict experimental \ | |
| -f flv ${YTS_URL}/${YTS_KEY} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment