# run in terminal by typing sh twitch.sh in the correct directory. also store .twitch_key.txt in the same directory if you'd like

# I'd highly suggest using pulseaudio to modify input/output to get your sound working as input so that is also sent to twitch.tv (aka music)

#originally found several old tutorials for this on youtube, this takes all the effort out of it and works perfectly on the latest ubuntu and stable as well.

INRES="1366x768"

#OUTRES="1024x640"

#OUTRES=" " extra output res if you want to comment/uncomment on the fly.

OUTRES="1366x768"

FPS="30"

QUAL="fast"

STREAM_KEY=$(cat ~/.twitch_key) #save your twitch/justin.tv key in a file called .twitch_key.txt

#need ffmpeg downloading to use these codecs for input/output to send properly

ffmpeg \

-f x11grab -s "$INRES" -r "$FPS" -i :0.0+0,0 -itsoffset 00:00:01 \

-f alsa -ac 2 -i pulse \

-vcodec libx264 -vpre "$QUAL" -s "$OUTRES" \

-acodec libmp3lame -ar 44100 -threads 4 -qscale 3 -b 712000 -bufsize 512k \