Milliseconds support for time overlay (recording and streaming)
#2,130 opened on May 31, 2021
Repository metrics
- Stars
- (3,533 stars)
- PR merge metrics
- (Avg merge 16d 14h) (33 merged PRs in 30d)
Description
Hi,
Great piece of software. I modified it to use without wifi to constantly monitor bat flights on a raspberry pi 3B simultaneous to audio recordings (no detection trigger used). (I use a local hotspot on my smartphone to setup the camera and check the stream). However I need now higher precision and implemented a milisecond overlay. In the camera-x.conf file it accepts miliseconds and also displays them in the overlay: text_right %Y-%m-%d %T.%3N However the overlay seems to be refreshed only every second so that I don`t really gain anything from the miliseconds since they show always the same 3 digits every second.
Therefore I used the bash script below which gets started and killed with motioneye server (c is a correction due to processing time):
#!/bin/bash #for recording correction (s) #c=-0.2 #for stream correction (s) c=+0.3 NOW=$( date '+%Y-%m-%d_%H:%M:%S.%3N' ) while : do curl "http://localhost:7999/1/config/set?text_right=`LANG=C date '+%Y-%m-%d %H:%M:%S.%3N' --date "NOW $c sec"`" sleep 0.01 done exit
This unfortunately uses 20% more cpu and I`m off by about +-50ms of real time (https://time.curby.net/clock) and it uses more energy. Since my devices are car battery powered and temperature in warm attics can play a role I would rather stay with 50% cpu usage while recording 10 minute 720p files instead of 70-80%.
See the timing in the attached picture:

Is there a way to change the overlay refresh interval to 10ms or 100ms in more efficient and precise way than using the above curl? So I could use it in combination with the normal "text_right %Y-%m-%d %T.%3N" in the config file. I saw in the monitor.py file an interesting variable: DEFAULT_INTERVAL = 1 # seconds I changed it to 0.1 and 2 directly in the install folder and compiled it, unfortunately without any effect. Or do I have to take additional steps beside changing the variable, compile it to a .pyc and reboot raspberry pi that the new values take effect?
Maybe my bash script can still be of use for some people if efficiency is not that important. :-)
Thanks for your help in advance.