Skip to content

Instantly share code, notes, and snippets.

@ckdarby
Created January 17, 2014 05:31
Show Gist options
  • Save ckdarby/8468835 to your computer and use it in GitHub Desktop.
Save ckdarby/8468835 to your computer and use it in GitHub Desktop.
Linux streaming Twitch
#! /bin/bash
# gist created by ckdarby
INRES="1920x1080"
OUTRES="1920x1080"
FPS="60"
QUAL="ultrafast"
SOUNDSOURCE="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" #pactl list sources | grep Name
# Write your key in a file named .twitch_key in your home directory
STREAM_KEY=$(cat ./twitch_key) # This is your streamkey generated by jtv/twitch found at: http://www.justin.tv/broadcast/adv_other
avconv \
-f x11grab -s $INRES -r "$FPS" -i :0.0 \
-f alsa -ac 2 -f pulse \
-i $SOUNDSOURCE \
-async 30 \
-vcodec libx264 -preset $QUAL \
-acodec libmp3lame -ac 2 -ar 44100 \
-b 2000k -minrate 2000k -maxrate 2000k -bufsize 2000k \
-strict normal \
-loglevel verbose \
-f flv "rtmp://live-jfk.twitch.tv/app/$STREAM_KEY"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment