From fc6dfaeb0a2bbc0f0c95a248ba30cec07666a87d Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:01:22 -0600 Subject: [PATCH] gr --- .../movement_detection_via_api_ffmpeg.sh | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh b/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh index d0e0f85..5a5183a 100644 --- a/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh +++ b/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh @@ -42,8 +42,8 @@ main() { echo uuid=$uuid stream=$stream recording=$recording ts=$ts api "/api/cameras/$uuid/$stream/view.mp4?s=$recording&ts=true" > /tmp/movement_detection_via_api_ffmpeg.sh.mp4 - local fps=$(ffprobe -i /tmp/movement_detection_via_api_ffmpeg.sh.mp4 2>&1 | grep -o '[0-9]*\.*[0-9]* fps' | head -n 1 | awk '{print $1}') - local inspection="$(ffmpeg -i /tmp/movement_detection_via_api_ffmpeg.sh.mp4 -vf 'select=not(mod(n\,'${fps%.*}')),select=gte(scene\,0),metadata=print:file=-' -an -f null - 2> /dev/null | paste - -)" + local fps=$(_ffprobe -i /tmp/movement_detection_via_api_ffmpeg.sh.mp4 2>&1 | grep -o '[0-9]*\.*[0-9]* fps' | head -n 1 | awk '{print $1}') + local inspection="$(_ffmpeg -i /tmp/movement_detection_via_api_ffmpeg.sh.mp4 -vf 'select=not(mod(n\,'${fps%.*}')),select=gte(scene\,0),metadata=print:file=-' -an -f null - 2> /dev/null | paste - -)" local scores=($(echo "$inspection" | awk '{print $NF}' | sed 's/.*=//')) local flattened_scores=() @@ -107,4 +107,20 @@ _perl() { fi } +_ffprobe() { + if which ffprobe &> /dev/null; then + ffprobe "$@" + else + /volume1/homes/squeaky2x3/ffmpeg-local/ffprobe "$@" + fi +} + +_ffmpeg() { + if which ffmpeg &> /dev/null; then + ffmpeg "$@" + else + /volume1/homes/squeaky2x3/ffmpeg-local/ffmpeg "$@" + fi +} + main "$@"