-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen_record
executable file
·36 lines (25 loc) · 1.09 KB
/
screen_record
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
#!/usr/bin/bash
# Choose the location, where the recordings will be saved
path=~/Pictures
# Creates a folder in the specified path, where the recordinds will be saved
mkdir -p ${path}/Screen_Recording/
# Choose the resolution of your display screen
video_resolution=1920X1080
# Choose the video format
extension=mp4 #mkv, mp4, mpeg
filename="Screen_Record_from_`date +%F_%H-%M-%S`.${extension}"
filePATH=${path}/Screen_Recording/${filename}
echo "Available sources"
pactl list short sources | awk '{ print $1, $2, $7}' | column -t
read -p "Enter the Source Number [press Enter to Choose Default]: " number
#echo Choosen number is $number
if [ -z "$number" ]
then
recordingDevice=`pactl list short sources | awk '$7 ~ /IDLE/ { print $2 }'`
else
recordingDevice=`pactl list short sources | awk -v Number="$number" '$1 ~ Number { print $2 }'`
fi
#echo Choosen source device is $recordingDevice
# Set the recording sound volume
pactl set-source-volume $recordingDevice 80%
ffmpeg -video_size $video_resolution -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i $recordingDevice $filePATH -loglevel error