-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshot.sh
More file actions
47 lines (39 loc) · 982 Bytes
/
screenshot.sh
File metadata and controls
47 lines (39 loc) · 982 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# names and extensions
export FN=`date +%F_%H%M%S%N`
export EXT="fb0"
export CODEC="png"
export RES=$1
# input/output files and folder name
export SINPUT=$FN"."$EXT
export SOUTPUT=$FN"_"$RES"."$CODEC
export SCSH="screenshots"
if [ ! "$RES" ];
then
echo "
Error: You forgot to add usage parameter...
Usage: . screenshot.sh device resolution
Example: .screenshot.sh 320x480";
else
if [ ! -d "$SCSH" ];
then
mkdir $SCSH
export CRTDIR="ok"
else
export CRTDIR=""
fi
adb pull /dev/graphics/fb0 $SINPUT
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s $RES -i $SINPUT -f image2 -vcodec $CODEC $SCSH"/"$SOUTPUT
rm $SINPUT
clear
if [ $CRTDIR ];
then
echo "The folder: $SCSH sucessfully created!"
fi
if [ -e $SCSH"/"$SOUTPUT ]
then
echo "The screenshot name $SOUTPUT"
else
echo "Error: Screenshot doesn't created!!!"
fi
fi