Skip to content

Instantly share code, notes, and snippets.

@acdimalev
Created April 27, 2013 04:43
Show Gist options
  • Save acdimalev/5471902 to your computer and use it in GitHub Desktop.
Save acdimalev/5471902 to your computer and use it in GitHub Desktop.
Streaming to Twitch using avconv (X11 and PulseAudio)
#!/bin/sh
key=live_... # grab this from your Twitch account
url=rtmp://live.twitch.tv/app/$key
# I'm pulling from my second monitor (-i :0.1)
# at fifteen frames a second (-r 15).
#
# It has an sxga resolution that I'm scaling to 524x420.
#
# Mind that the width of the video has to be
# a multiple of 2, so I'm stretching it by one pixel.
# Also tossed in some bitrate bits that seem sane
# for my Internet connection
#
# video: 4 mbps max (-maxrate 4m)
# audio: 128 kbps (-b:a 128k)
# Practically everything else is compatibility voodoo.
avconv \
-f x11grab -video_size sxga -r 15 -i :0.1 \
-f pulse -i default \
-c:v libx264 -vf scale=524:420 -maxrate 4m \
-profile:v baseline -pix_fmt yuv420p \
-c:a libmp3lame -b:a 128k \
-ar 44100 \
-f flv $url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment