Broadcasting to twitch.tv using ffmpeg
There wasn’t a whole lot of information about it around but I managed to piece together a quick script to do live streaming from a linux desktop. It’s simple and for speed reasons I’m not broadcasting sound myself. (I get unrealiable levels of upload lag so if i add sound it’s kinda distorted…I really wish their streams allowed speex codec :/)
#!/bin/bashSIZE=”1600×1200″
BITRATE=”128k”
FRAMERATE=”20″
KEY=”your key here”
ffmpeg -f x11grab -s $SIZE -r $FRAMERATE -i :0.0 -vb $BITRATE -vcodec libx264 -threads 0 -f flv “rtmp://live.justin.tv/app/$KEY”
if you do want sound, you can change it to this for alsa
ffmpeg -f x11grab -s $SIZE -r $FRAMERATE -i :0.0 -f alsa -ac 2 -i hw:0,0 -vb $BITRATE -vcodec libx264 -threads 0 -acodec libmp3lame -ab 128k -ar 22050 -f flv “rtmp://live.justin.tv/app/$KEY”or for OSS
ffmpeg -f x11grab -s $SIZE -r $FRAMERATE -i :0.0 -f oss -i /dev/dsp -vb $BITRATE -vcodec libx264 -threads 0 -acodec libmp3lame -ab 128k -ar 22050 -f flv “rtmp://live.justin.tv/app/$KEY”Tags: tips
8This entry was posted on Friday, April 13th, 2012 at 12:42 pm and is filed under LD #23. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.