5

This question already has an answer here:

Alright so I've had Linux Ubuntu 12.04 for over a year now and I still don't know anything about it. That only thing I can do with it is use the internet. I want to start streaming games that I play on my computer to Twitch.tv., but I don't know how. All of the downloads are only for windows. I found a website that tells you how to do it, but since I know nothing about linux, I can't do it. I haven't been able to get past the first step yet. Can someone please give me a step by step tutorial on how to do it. Please do not think you are being to specific, because I am sure it will help me. The link to the website is this -http://www.creativetux.com/2012/11/streaming-to-twitchtv-with-linux.html

marked as duplicate by Charles Green, Eric Carvalho, user68186, vanadium, Jim Mar 18 at 1:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6

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/

  • Thanks for your help! This looks like something I could use. However, when I try your example, or the one you have linked to, I get the following error: [X11grab indev @ 0x1d05440] Unable to parse option value "1920x1080+0+0" as image size [X11grab indev @ 0x1d05440] Error setting option video_size to value 1920x1080+0+0. (full log here) What to do? – Nickolai Leschov Dec 3 '13 at 13:34
  • What did you use for your INRES and OUTRES variables? It's complaining about your defined size of "1920x1080+0+0". Either this is the wrong format or you've got some special characters instead of double quotes. Make sure you have double quotes only in the script. – alexgophermix Dec 3 '13 at 18:30
  • INRES=$(xwininfo -root | awk '/geometry/ {print $2}'i), OUTRES="640x360", as in your example. (xwininfo) – Nickolai Leschov Dec 3 '13 at 18:59
  • 1
    This works. Now it goes "File for preset 'fast' not found ". How do I check which presets are there? – Nickolai Leschov Dec 3 '13 at 21:55
  • 1
    You may have a different version of ffmpeg. Newer versions of ffmpeg use the option -preset instead. Try to use -preset "fast" instead of -vpre "fast" – alexgophermix Dec 4 '13 at 18:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.