Skip to content

Instantly share code, notes, and snippets.

@memborsky
Created April 10, 2012 20:23
Show Gist options
  • Save memborsky/2354214 to your computer and use it in GitHub Desktop.
Save memborsky/2354214 to your computer and use it in GitHub Desktop.
Streaming to justin.tv with ffmpeg in linux
#!/bin/sh -xe
INFO=$(xwininfo -frame)
API_KEY="YOUR_API_KEY_GOES_HERE"
WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')
WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' )
FPS="15"
INRES='1680x1010'
OUTRES='1280x720'
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+$WIN_XY \
-f alsa -ac 2 -i default -vcodec libx264 -s "$OUTRES" \
-acodec libmp3lame -ab 128k -ar 44100 -threads 0 \
-f flv "rtmp://live.justin.tv/app/$API_KEY"
@memborsky
Copy link
Author

Original version of this script was provided by @rtyler on his blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment