Created
May 5, 2015 10:05
-
-
Save myokoym/f417d222abc4b6dfc55e to your computer and use it in GitHub Desktop.
Capture a terminal to FLV video using FFmpeg on Debian GNU/Linux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
output_path = "#{ARGV[0] || "out"}.flv" | |
info = `xwininfo -id $(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | grep -Eo "0x[0-9a-f]{2,}")` | |
x = info.scan(/Absolute upper-left X: *(\d+)/).first.last.to_i | |
y = info.scan(/Absolute upper-left Y: *(\d+)/).first.last.to_i | |
width = info.scan(/Width: *(\d+)/).first.last.to_i | |
height = info.scan(/Height: *(\d+)/).first.last.to_i | |
system("ffmpeg -r 10 -s #{width},#{height} -f x11grab -i :0.0+#{x},#{y} -f alsa -i default -an -vcodec libx264 -b 400k -threads 4 -vsync 1 -y -f flv #{output_path}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment