Skip to content

Instantly share code, notes, and snippets.

@xorrizon
Created September 27, 2013 19:40
Show Gist options
  • Select an option

  • Save xorrizon/6734100 to your computer and use it in GitHub Desktop.

Select an option

Save xorrizon/6734100 to your computer and use it in GitHub Desktop.
Bash script for twitch streaming with ffmpeg. Also uses offset to use my 2nd monitor
#!/bin/bash
API_KEY="live_XXX"
FPS="30"
#INRES="1920x1200"
INRES="1920x1080"
OUTRES="$INRES"
#OUTRES="640x400"
#OFFSET="+0,0"
OFFSET="+1600,0" # use xwininfo to get
STREAM_URL="rtmp://live.twitch.tv/app/$API_KEY"
#STREAM_URL=/media/home2/test.flv
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0$OFFSET \
-f pulse -ac 2 -i default -vcodec libx264 -s "$OUTRES" \
-acodec libmp3lame -ab 128k -ar 44100 -threads 0 \
-f flv -pix_fmt yuv420p "$STREAM_URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment