forked from stb-tester/stb-tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stbt-screenshot
executable file
·28 lines (23 loc) · 909 Bytes
/
stbt-screenshot
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
#!/bin/bash
# Copyright 2013 YouView TV Ltd.
# License: LGPL v2.1 or (at your option) any later version (see
# https://github.com/stb-tester/stb-tester/blob/master/LICENSE for details).
#/ usage: stbt screenshot [-h] [filename]
#/
#/ Capture a screenshot from the system-under-test to the specified filename
#/ (defaults to 'screenshot.png'), using the GStreamer source pipeline
#/ specified in your stbt config file.
#/
#/ Options:
#/ -h, --help Show this help message and exit.
[[ "$1" == -h || "$1" == --help ]] && { grep '^#/' "$0" | cut -c4-; exit 0; }
filename=${1:-screenshot.png}
"$(dirname "$0")/stbt-run" -v --control=none --save-video= <(cat <<-EOF
import time
get_frame()
if (args.source_pipeline.startswith("decklink")):
time.sleep(2) # First second of Blackmagic video has purple tint
save_frame(get_frame(), "$filename")
print "Screenshot saved to '$filename'"
EOF
)