-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake-screencast
45 lines (43 loc) · 1.08 KB
/
make-screencast
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
#!/bin/bash
TIME=$(date +%Y-%m-%d_%H-%M-%S)
case "$1" in
--trim)
if [[ "$2" -ne "0" || -z "$2" ]]; then
echo "Missing or incorrect parameters."
exit
fi
echo "file: $2, start: $3, end: $4"
# Trim to specific start and end times in FFMPEG.
ffmpeg -y \
-noaccurate_seek \
-ss "$3" \
-i "$2" \
-to "$4" \
-acodec copy \
-vcodec copy \
-movflags faststart \
-avoid_negative_ts make_zero \
video_trimmed_$TIME.mp4
exit
;;
--record)
# capture screen data
ffmpeg -y \
-f x11grab \
-s $(xdpyinfo | grep dimensions | awk '{print $2}') \
-i :0.0 \
-f pulse -ac 1 -ar 48000 \
-i default \
-filter_complex "compand=attacks=0:points=-60/-40|-30/-15|-15/-10|-5/-8|0/-6" \
-c:v libx264 -r 30 \
-c:a mp3 \
video_capture_$TIME.mp4
exit
;;
*)
echo "usage: make-screencast < --record | --trim > < videofile > < start time hh:mm:ss > < duration hh:mm:ss >"
echo "The script will record or trim the video, saving it as an mp4 file."
echo "Trim only the original, not trimmed output, otherwise loss of quality will result!"
exit
;;
esac