1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 13:38:12 +00:00
trezor-firmware/ci/hardware_tests/record_video.sh
Martin Milata dedca1bb13 ci: ffmpeg tweaks in hardware tests
Running ffmpeg in a subshell and killing it in exit trap handler should
ensure video availability even when bootstrap or pytest fail.
2021-02-05 12:58:21 +01:00

22 lines
640 B
Bash
Executable File

#!/usr/bin/env bash
if [ $# -ne 2 ]
then
echo "Usage: $0 commit_id [start|stop]"
fi
OUTPUTFILE=video_$1_$(date +%s).mp4
INPUTDEVICE=/dev/video0
if [ "$2" == "start" ]; then
echo "[software/video] Starting record to $OUTPUTFILE"
ffmpeg -loglevel warning -f oss -f video4linux2 -i $INPUTDEVICE \
-flush_packets 1 \
-vf "drawtext=font=Dejavu Sans: \
text='$1 | %{localtime} | %{pts}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1: fontsize=15" $OUTPUTFILE &
export VPID=$!
elif [ "$2" == "stop" ]; then
echo "[software/video] Stopping the recording of $OUTPUTFILE"
pkill ffmpeg
sync
fi