-
Notifications
You must be signed in to change notification settings - Fork 2
/
ffmpeg-webm-grab
64 lines (55 loc) · 1.37 KB
/
ffmpeg-webm-grab
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# ffmpeg-webm-grab
# Bash script to create webms from grabbing screen. No audio is included.
# ffmpeg is required.
# xrectsel is required. https://github.com/lolilolicon/FFcast2/blob/master/xrectsel.c
# See https://github.com/WhatIsThisImNotGoodWithComputers/ffmpeg-webm-scripts for usage.
# Created by WhatIsThisImNotGoodWithComputers (ohgod AT whatisthisimnotgoodwithcomputers DOT com)
#vars
OUTPUT_FILE="grab.webm"
FRAMERATE="2500K"
TEMP=`getopt --long -o "i:s:t:o:f:d:" "$@"`
DELAY=10
#params
eval set -- "$TEMP"
while true ; do
case "$1" in
-i )
INPUT_FILE=$2
shift 2
;;
-s )
START_TIME=$2
shift 2
;;
-t )
TO_TIME=$2
shift 2
;;
-o )
OUTPUT_FILE=$2
shift 2
;;
-f )
FRAMERATE=$2
shift 2
;;
-d )
DELAY=$2
shift 2
;;
*)
break
;;
esac
done;
X11GRAB=$(xrectsel "-f x11grab -s %wx%h -i :0.0+%x,%y") || exit -1
echo $X11GRAB;
echo -e "\033[05;44;33mRecording in $DELAY seconds (-d). Press q to stop recording.\033[0m"
echo
for (( i=$DELAY; i>0; --i )) ; do
echo $i
sleep 1
done
ffmpeg ${X11GRAB} -c:v libvpx -an -b:v $FRAMERATE -threads 0 -tune zerolatency -crf 0 -preset ultrafast $OUTPUT_FILE
exit 0