Streaming to in Ubuntu Linux!

So apparently i am writing this like a new post. I had a script for streaming to with ffmpeg, but apparently it doesn’t work for that anymore. So i found a script on github that i will share with you. This time it is using avconv.

Open a terminal, and create a file in your home directory or where ever you want, and name it “twitch-stream“, with this command “touch twitch-stream“. Then open it with a editor, and add this script to it.

#! /bin/bash
# originaly from from taladan
# gist created by brodul
INRES=”1600×900″ # input resolution
OUTRES=”1600×900″ # Output resolution
FPS=”30″ # target FPS
STREAM_KEY=$(cat ~/.twitch_key)
avconv \
-f x11grab -s $INRES -r “$FPS” -i :0.0 \
-f alsa -ac 2 -i pulse \
-vcodec libx264 -s $OUTRES -preset $QUAL \
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b 712000 -bufsize 512k \
-f flv “rtmp://$STREAM_KEY”
Ok so apparently this one is simular to the last one i had on here.
1.) set your INRES=
2.) set your OUTRES=
3.) set your FPS=
4.) you can set your QUAL=  <– i have it set to ultrafast. Really depends on your bandwith
5.) this script is telling us to put your live twitch key in a file in your home directory called “.twitch_key” .. so in our home directory we just type in “touch .twitch_key“, and then get our key from (you must be logged in to, and press the “Show Key” button on the right) Copy and past your key into “.twitch_key”, then save it.
6.) then run “chmod +x twitch-stream
I just tested this out on my laptop and i had to install something extra, because it was giving me an error “Unrecognized option ‘preset’ Failed to set value ‘ultrafast’ for option ‘preset’“. So i did “sudo apt-get install libavcodec-extra-53", and tried to run my script again. It started up, and i was able to view it on my twitch page. Also found out that sound wasn't working, so i noticed in the script that it is using libmp3lame. So make sure you install lame with "sudo apt-get install lame". It should now work well.
I hope this works out better than the last script with ffmpeg. I know it was working for me when i first created that last one, but it wasn’t working when i just tried it. Sorry for all that confusion.
PS: if you want to stream to, you just change the line on the bottom from “rtmp://$STREAM_KEY“, to “rtmp://$STREAM_KEY