How to stream on Twitch.Tv [duplicate]

Solution 1:

You'll likely have to use ffmpeg or avconv and supply your Twitch.tv key which can be found here: http://www.twitch.tv/broadcast/dashboard/streamkey

Personally I use ffmpeg because avconv for some reason only displays my mouse on the stream when streaming from my laptop. A short example of this would be:

# stream key. You can set this manually.
STREAM_KEY=$(cat ~/.twitch_key)

# stream url. Note the formats for twitch.tv and justin.tv
# twitch:"rtmp://live.twitch.tv/app/$STREAM_KEY"
# justin:"rtmp://live.justin.tv/app/$STREAM_KEY"
STREAM_URL="rtmp://live.twitch.tv/app/$STREAM_KEY"

ffmpeg \
-f alsa -ac 2 -i "pulse" \
-f x11grab -s $(xwininfo -root | awk '/geometry/ {print $2}'i) -r "30" -i :0.0 \
-vcodec libx264 -s "640x360" -vpre "fast" \
-acodec libmp3lame -threads 6 -qscale 5 -b 64KB \
-f flv -ar 44100 "$STREAM_URL"

There are several gists out there that bundle the whole process into a more understandable script. I couldn't find one that I liked so I created my own based on the code above: https://gist.github.com/oseparovic/2db2aaa737cd37e7c068

You can see more about streaming to twitch.tv/justin.tv from ubuntu in this post: http://www.thegameengine.org/miscellaneous/streaming-twitch-tv-ubuntu/