15min ago
parent
e27af38bd7
commit
00097d3357
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local one_hour_ago_unix="$(($(date +%s) - 60 * 60))"
|
local nonrecent_unix="$(($(date +%s) - 15 * 60))"
|
||||||
local one_hour_ago_ts="$(date -d @$one_hour_ago_unix -u +%Y-%m-%dT%H:%M:%SZ)"
|
local nonrecent_ts="$(date -d @$nonrecent_unix -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
|
||||||
for uuid in $(
|
for uuid in $(
|
||||||
api /api/ | jq -r .cameras[].uuid
|
api /api/ | jq -r .cameras[].uuid
|
||||||
|
|
@ -15,15 +15,21 @@ main() {
|
||||||
| jq -r .[0] \
|
| jq -r .[0] \
|
||||||
| sort -n #-r
|
| sort -n #-r
|
||||||
); do
|
); do
|
||||||
api "/api/cameras/$uuid/$stream/view.mp4?s=$recording&ts=true" > /tmp/f.mp4
|
local ts="$(date -u -d @"$(
|
||||||
|
api "/api/cameras/$uuid/$stream/view.mp4.txt?s=$recording&ts=true" \
|
||||||
local ts="$(ffprobe /tmp/f.mp4 2>&1 | grep creation_time | tail -n 1 | awk '{print $NF}' | sed 's/\.000000Z/Z/')"
|
| grep -A 1 last_modified: \
|
||||||
if [[ "$ts" > "$one_hour_ago_ts" ]]; then
|
| head -n 2 \
|
||||||
echo "$ts > $one_hour_ago_ts, skipping"
|
| tail -n 1 \
|
||||||
|
| awk '{print $NF}' \
|
||||||
|
| tr -d ','
|
||||||
|
)" +%Y-%m-%dT%H:%M:%SZ )"
|
||||||
|
if [[ "$ts" > "$nonrecent_ts" ]]; then
|
||||||
|
echo "$ts > $nonrecent_ts, so skipping"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo uuid=$uuid stream=$stream recording=$recording ts=$ts
|
echo uuid=$uuid stream=$stream recording=$recording ts=$ts
|
||||||
|
api "/api/cameras/$uuid/$stream/view.mp4?s=$recording&ts=true" > /tmp/f.mp4
|
||||||
|
|
||||||
local fps=$(ffprobe -i /tmp/f.mp4 2>&1 | grep -o '[0-9]*\.*[0-9]* fps' | head -n 1 | awk '{print $1}')
|
local fps=$(ffprobe -i /tmp/f.mp4 2>&1 | grep -o '[0-9]*\.*[0-9]* fps' | head -n 1 | awk '{print $1}')
|
||||||
local inspection="$(ffmpeg -i /tmp/f.mp4 -vf 'select=not(mod(n\,'${fps%.*}')),select=gte(scene\,0),metadata=print:file=-' -an -f null - 2> /dev/null | paste - -)"
|
local inspection="$(ffmpeg -i /tmp/f.mp4 -vf 'select=not(mod(n\,'${fps%.*}')),select=gte(scene\,0),metadata=print:file=-' -an -f null - 2> /dev/null | paste - -)"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue