So apparently i am writing this like a new post. I had a script for streaming to twitch.tv 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.
# gist created by brodul
INRES=”1600×900″ # input resolution
OUTRES=”1600×900″ # Output resolution
FPS=”30″ # target FPS
-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://live.twitch.tv/app/$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 http://twitch.tv/broadcast
. (you must be logged in to twitch.tv, 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
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 justin.tv, you just change the line on the bottom from “rtmp://live.twitch.tv/app/$STREAM_KEY“, to “rtmp://live.justin.tv/app/$STREAM_KEY“