-
Notifications
You must be signed in to change notification settings - Fork 0
/
desktop2ffmpeg.sh
58 lines (50 loc) · 1.19 KB
/
desktop2ffmpeg.sh
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
#!/bin/bash
usage() { echo "Usage: $0 [-s <screen resolution>] [-r <FPS> ] [-o <path and file name to save> ] [-h <help> ]" 1>&2; exit 1; }
while getopts ":s:r:o:h" o; do
case "${o}" in
s)
RES=${OPTARG}
;;
r)
FPS=${OPTARG}
;;
o)
FILE=${OPTARG}
;;
h)
echo ""
echo "Welcome on the desktop2ffmpeg helper"
echo ""
echo "Options :"
echo ""
echo "-s is your screen size, you must inquire this option with the correct size of your screen (ex : 1920x1080)"
echo ""
echo "-r is the frame rate. (Default framerate = 30)"
echo ""
echo "-o is the file saving path. (Default = ~/video1.mpg)"
echo ""
echo "For -o do not inquire the file extension. It is already inquired as .mpg"
echo ""
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "$RES" ];
then usage
fi
if [ -z "$FPS" ];
then FPS=30
fi
if [ -z "$FILE" ];
then FILE=~/video1
fi
echo "Screen resolution = $RES"
echo "Frame rate = $FPS fps"
echo "Saved file path = $FILE.mpg"
FFMPEG=/usr/bin/ffmpeg
$FFMPEG -f x11grab -s $RES -r $FPS -i :0.0 \
-f alsa -i pulse -vcodec libx264 \
$FILE.mpg