1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-16 04:29:08 +00:00
trezor-firmware/ci/hardware_tests/record_video.sh

24 lines
683 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-01-13 23:39:19 +00:00
if [ $# -ne 3 ]
then
2021-01-13 23:39:19 +00:00
echo "Usage: $0 video_dev commit_id [start|stop]"
fi
2021-01-13 23:39:19 +00:00
INPUTDEVICE=$1
COMMIT=$2
ACTION=$3
OUTPUTFILE=video_${COMMIT}_$(date +%s).mp4
2021-01-13 23:39:19 +00:00
if [ "$ACTION" == "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: \
2021-01-13 23:39:19 +00:00
text='$COMMIT | %{localtime} | %{pts}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1: fontsize=15" $OUTPUTFILE &
export VPID=$!
2021-01-13 23:39:19 +00:00
elif [ "$ACTION" == "stop" ]; then
echo "[software/video] Stopping the recording of $OUTPUTFILE"
pkill ffmpeg
sync
fi