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

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

2 Answers 2

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/

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

Easier, get Screenstudio. It's a project I started simply because I got tired of tweaking scripts.

Get it at http://screenstudio.crombz.com

It's open source, free and great!

share|improve this answer
    
Could you provide some more details and installation instructions? Just a link isn't that great of an answer and it looks like spam. –  Seth Jun 1 at 14:38
    
Fails with an error - but no error message so I've nothing to debug –  hippyjim Jun 7 at 13:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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