-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.picol
79 lines (67 loc) · 2.41 KB
/
init.picol
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -----------------------------------------------------------------------------
# Initialisation script for offscreen command interpreter
# Creates proc to take snapshot and record video
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Takes a picture of current frame
# -----------------------------------------------------------------------------
proc image {type fout col} {
set w [width]
set h [height]
set pid [execbg ./grab-$type -s -w $w -h $h -o $fout]
after 100
colorspace $col
kill add $pid
}
proc png {fout} {
image png $fout rgb
}
proc jpeg {fout} {
image jpeg $fout yuv
}
# -----------------------------------------------------------------------------
# Video recording
# -----------------------------------------------------------------------------
proc video {type fout nframes} {
set w [width]
set h [height]
set fps [fps]
set pid [execbg ./${type}enc -w $w -h $h -n $nframes -f $fps -o $fout --rcmode CBR]
after 200
colorspace yuv
kill add $pid
}
proc h264 {fout nframes} {
video h264 $fout $nframes
}
proc h265 {fout nframes} {
video h265 $fout $nframes
}
# -----------------------------------------------------------------------------
# Video streaming
# -----------------------------------------------------------------------------
proc h264stream {nframes} {
execbg rm -f /tmp/h264fifo
execbg mkfifo /tmp/h264fifo
after 100
h264 /tmp/h264fifo $nframes
puts {--------------------------------------------}
puts {Note RTSP URL below to play stream}
puts {--------------------------------------------}
execbg ./h264streamer -s h264 -i /tmp/h264fifo
puts {--------------------------------------------}
}
# -----------------------------------------------------------------------------
# Video streaming
# -----------------------------------------------------------------------------
proc h265stream {nframes} {
execbg rm -f /tmp/h265fifo
execbg mkfifo /tmp/h265fifo
after 100
h265 /tmp/h265fifo $nframes
puts {--------------------------------------------}
puts {Note RTSP URL below to play stream}
puts {--------------------------------------------}
execbg ./h265streamer -s h265 -i /tmp/h265fifo
puts {--------------------------------------------}
}