-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapture_window.sh
More file actions
executable file
·27 lines (22 loc) · 918 Bytes
/
capture_window.sh
File metadata and controls
executable file
·27 lines (22 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Author: Rafa Laguna
# Twitter: @rafalagoon
# Licence: GPL v3
# Status: WIP ;)
# Description: Fairly simple and effective window video capture
if [ $# -eq 0 ]; then
echo "File name needed:"
echo -e "\t"$0" FILENAME"
exit 1
fi
echo "Select the window you want to capture"
wininfo=`xwininfo`
IFS='\n'
win_w=`echo $wininfo | grep "Width:" | cut -d : -f 2 | tr -d ' '`
win_h=`echo $wininfo | grep "Height:" | cut -d : -f 2 | tr -d ' '`
win_x=`echo $wininfo | grep "Absolute upper-left X:" | cut -d : -f 2 | tr -d ' '`
win_y=`echo $wininfo | grep "Absolute upper-left Y:" | cut -d : -f 2 | tr -d ' '`
echo "Capturing..."
avconv -f x11grab -r 30 -s "$win_w"x"$win_h" -i :0.0+"$win_x","$win_y+nomouse" -vcodec libx264 -pre lossless_ultrafast -crf 0 -threads 0 "$1".mp4
echo "Compressing for editing..."
avconv -i "$1".mp4 -strict experimental -f mp4 -vcodec libx264 -preset slow -crf 1 "$1"_compress.mp4