Skip to content

Instantly share code, notes, and snippets.

@nilsmagnus
Created May 16, 2022 09:42
Show Gist options
  • Save nilsmagnus/06a96c945c9376b43a22c09c107d3e81 to your computer and use it in GitHub Desktop.
Save nilsmagnus/06a96c945c9376b43a22c09c107d3e81 to your computer and use it in GitHub Desktop.
Stream to twitch with libcamera-vid and ffmpeg
#!/bin/bash
STREAM_KEY=<insert your twitch stream key>
## you might want to use a different twitch-server, see https://stream.twitch.tv/ingests/
while true
do
libcamera-vid -o - --brightness 0.1 -t 0 -g 30 --width 640 --height 480 | ffmpeg -re -f h264 -i pipe:0 -vcodec copy -strict experimental -f flv rtmp://osl.contribute.live-video.net/app/$STREAM_KEY
# pause a bit if things fail before restart
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment