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) · 971 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 device-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.py" -v --control=none --save-video= <(cat <<-EOF
import time, stbt_core as stbt
stbt.get_frame()
if stbt._dut._display.source_pipeline_description.startswith("decklink"):
time.sleep(2) # First second of Blackmagic video has purple tint
stbt.save_frame(stbt.get_frame(), "$filename")
print("Screenshot saved to '$filename'")
EOF
)