Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

share|improve this question
possible duplicate of How do I stream to Twitch.tv? –  Jorge Castro Aug 29 at 15:18

1 Answer 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"

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/

share|improve this answer
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
Ah, it looks like $(xwininfo -root | awk '/geometry/ {print $2}'i) is returning an inproperly formatted size on your machine. Try manually setting your desired input resolution instead. For example: "1920x1080". If you need it to automatically pull the dimensions of your screen try this instead: $(xdpyinfo | grep 'dimensions:'|awk '{print $2}') –  alexgophermix Dec 3 '13 at 20:01
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

protected by Community Nov 29 '14 at 17:40

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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