Ваш ЦП будет выведен из состояния простоя; при большем напряжении и большей частоте при прохождении порогового значения. Поскольку вы не используете операционную систему реального времени, всевозможные вещи в фоновом режиме могут иногда сочетаться с тем, что вы запускаете на переднем плане, чтобы преодолеть этот порог.
lscpu | grep MHz
См.
Как изменить продолжительность срезов времени -, используемых планировщиком ЦП Linux?
и
https://askubuntu.com/questions/218567/any-way-to-check-the-clock-speed-of-my-processor/218570
Я нашел способ, однако это не самое элегантное решение с точки зрения обработки. Адаптировано из этого обсуждения imagemagick .
#!/bin/bash
set -ea
DIRECTORY=/camera/$(date +%Y-%m-%d)
[ $test -d $DIRECTORY ] && : || mkdir -p $DIRECTORY;
#Loglevel panic is to ignore the transform errors this camera is putting out.
#Forcing the RTSP transport as TCP to reduce corrupt images.
#Using date with strftime, however this could probably be done as a variable.
ffmpeg -loglevel panic -rtsp_transport tcp -y -i "rtsp://user:pass@ipaddress/stream" -frames:v 1 -strftime 1 "$DIRECTORY/%Y-%m-%d_%H-%M-%S_underwater_cam.jpg"
cd $DIRECTORY
#Find the most recent image, as it's assumed to be the picture above.
image=`ls -t $DIRECTORY | head -n1`
#threshold in percentage of light using imagemagick
thresh=10
mean=`convert $image -format "%[mean]" info:`
mean=`convert xc: -format "%[fx:100*$mean/quantumrange]" info:`
test=`convert xc: -format "%[fx: ($mean<$thresh)?1:0]" info:`
#example statement[ $test -eq 1 ] && echo "mean=$mean; too dark" || echo "mean=$mean; not too dark"
[ $test -eq 1 ] && rm $DIRECTORY/$image || :