Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Last active September 7, 2021 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/f99af390fc75935c6cf21bae601684f3 to your computer and use it in GitHub Desktop.
Save Hermann-SW/f99af390fc75935c6cf21bae601684f3 to your computer and use it in GitHub Desktop.
Measure framerate really achieved by raspividyuv (varying mode, width, height, record time and requested framerate)
# mfpsyuv: measure framerate really achieved by raspividyuv, varying
# mode, width, height, record time and requested framerate
#
#!/bin/bash
align () {
let x=$(($1-1))
echo $((x+$2-(x%$2)))
}
if [[ $# -lt 5 ]]; then echo "$0 mode w h t fps"; exit 1; fi
tst=`vcgencmd get_camera | grep detected=1`
if [[ $tst == "" ]]; then echo "no camera detected"; exit 1; fi
#time \
raspividyuv -md $1 -o /dev/shm/t.yuv -t $4 -fps $5 -w $2 -h $3
cmd=`wc --bytes /dev/shm/t.yuv | cut -f1 -d\ `\
"/($(align $2 32)*$(align $3 16)*3/2)/($4/1000)"
echo $cmd | bc -ql
@Hermann-SW
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment