Skip to content

Instantly share code, notes, and snippets.

@stef
Created March 16, 2012 21:56
Show Gist options
  • Save stef/2053030 to your computer and use it in GitHub Desktop.
Save stef/2053030 to your computer and use it in GitHub Desktop.
iirc this streams the contents of an x11 window via flash...
#!/bin/ksh
res=svga
eval $(xwininfo -frame | awk '/Absolute upper-left X/ { print "x="$NF }
/Absolute upper-left Y/ { print "y="$NF }
/Width/ { print "width="$NF }
/Height/ { print "height="$NF }')
offset=${x},${y}
res=$(( (width/16)*16))x$(( (height/16)*16))
ffservercfg=$(mktemp /tmp/screenfire.XXXXXXXXXX) || exit 1
cat >$ffservercfg <<EOT
Port 8090
BindAddress 0.0.0.0
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed screenfire.ffm>
File /home/stef/data/screenfire.ffm
FileMaxSize 32M
ACL allow 127.0.0.1
</Feed>
<Stream screenfire.avi>
Feed screenfire.ffm
Format avi
VideoBitRate 600
VideoFrameRate 25
VideoSize ${res}
VideoGopSize 12
VideoHighQuality
Video4MotionVector
NoAudio
</Stream>
<Stream stat.html>
Format status
ACL allow localhost
ACL allow 192.168.2.0 192.168.2.255
</Stream>
<Redirect index.html>
URL http://localhost:8090/screenfire.avi
</Redirect>
EOT
cat $ffservercfg
ffserver -f $ffservercfg &
sleep 1
ffmpeg -f x11grab -s ${res} -r 25 -i $DISPLAY+${offset} http://localhost:8090/screenfire.ffm || {
kill %1
rm $ffservercfg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment