Constant RPi4 Watchdog ffmpeg shutdowns causing CPU to spike hard
See original GitHub issueDescribe the bug On my RPi4 4GB, I am getting ffmpeg errors in the console. These errors don’t always start immedateily. A lot of the times, several clips will be written before I see these errors. This is running on the 32-bit Raspberry OS. Currently not using a Coral device since I’m waiting on a USB one to come available.
It should be noted that clips are still being generated just fine even with these errors. However, when these errors begin, CPU utilization jumps to 200%+ according to top
. Python 3 seems to be the culprit according to what is showing in top
. I am using a single zone here. I’ve not messed with zones before so its possible I have it wrong. My goal is just to record clips while cars are seen passing through the zone which is a “road”.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x17d3ce0] moov atom not found
frigate | /tmp/cache/driveway-20201230130715.mp4: Invalid data found when processing input
frigate | frigate.events INFO : bad file: driveway-20201230130715.mp4
frigate | watchdog.driveway INFO : Terminating the existing ffmpeg process...
frigate | watchdog.driveway INFO : Waiting for ffmpeg to exit gracefully...
frigate | [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1d93ce0] moov atom not found
frigate | /tmp/cache/driveway-20201230130725.mp4: Invalid data found when processing input
frigate | frigate.events INFO : bad file: driveway-20201230130725.mp4
frigate | watchdog.driveway INFO : Terminating the existing ffmpeg process...
frigate | watchdog.driveway INFO : Waiting for ffmpeg to exit gracefully...
frigate | [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1e33ce0] moov atom not found
Version of frigate
image: blakeblackshear/frigate:0.8.0-beta3-armv7
docker-compose.yml
services:
frigate:
container_name: frigate
restart: unless-stopped
privileged: true
image: blakeblackshear/frigate:0.8.0-beta3-armv7
volumes:
- /dev/bus/usb:/dev/bus/usb
- /etc/localtime:/etc/localtime:ro
- /home/rodman/frigate/config:/config
- /home/rodman/frigate/clips:/media/frigate/clips
#- <path_to_directory_for_recordings>:/media/frigate/recordings
- type: tmpfs # 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 100000000
ports:
- "5000:5000"
- "1935:1935"
environment:
FRIGATE_RTSP_PASSWORD: "password"
Config file
mqtt:
host: 10.200.200.44
user: frigate
password: password
save_clips:
max_seconds: 300
retain:
default: 10
ffmpeg:
global_args: -hide_banner -loglevel info
ffmpeg:
hwaccel_args:
- -c:v
- h264_mmal
objects:
track:
- car
cameras:
driveway:
ffmpeg:
inputs:
- path: rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.200.200.14:554/cam/realmonitor?channel=1&subtype=1
roles:
- rtmp
- detect
- path: rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.200.200.14:554/cam/realmonitor?channel=1&subtype=0
roles:
- clips
height: 480
width: 704
fps: 5
save_clips:
enabled: True
pre_capture: 1
zones:
road:
coordinates: 0,198,1,106,618,72,663,119
Logs
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x17d3ce0] moov atom not found
frigate | /tmp/cache/driveway-20201230130715.mp4: Invalid data found when processing input
frigate | frigate.events INFO : bad file: driveway-20201230130715.mp4
frigate | watchdog.driveway INFO : Terminating the existing ffmpeg process...
frigate | watchdog.driveway INFO : Waiting for ffmpeg to exit gracefully...
frigate | [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1d93ce0] moov atom not found
frigate | /tmp/cache/driveway-20201230130725.mp4: Invalid data found when processing input
frigate | frigate.events INFO : bad file: driveway-20201230130725.mp4
frigate | watchdog.driveway INFO : Terminating the existing ffmpeg process...
frigate | watchdog.driveway INFO : Waiting for ffmpeg to exit gracefully...
frigate | [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1e33ce0] moov atom not found
Frigate debug stats
{"detection_fps":6.3,"detectors":{"coral":{"detection_start":1609356406.121991,"inference_speed":150.34,"pid":30}},"driveway":{"camera_fps":5.0,"capture_pid":34,"detection_fps":6.3,"pid":33,"process_fps":1.9,"skipped_fps":0.0}}
FFprobe from your camera
Run the following command and paste output below
ffprobe <stream_url>
I can't seem to figure this out. I can exec in but running that command with my URL doesn't work.
Screenshots
Computer Hardware
- OS: Raspberry OS 32bit
- Virtualization: None. Just standard Docker container
- Coral Version: None Yet. Just CPU
- Network Setup: Wired
Camera Info:
- Manufacturer: Dahua
- Model: [e.g. 5442
- Resolution: Substream is 704x480 while main stream is 2688x1520. All H.254
- FPS: 5
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Yes, it’s reported and merged to 0.8.0 via https://github.com/blakeblackshear/frigate/commit/dabb36ad9366f30fd4b13037ad544f47100cb9d9
Wow. Excellent! Man I was pulling my hair out with my Pi and about ready to throw in the towel. Thanks for catching this!
I guess I don’t have this issue with my other installation of Frigate on my NUC because the camera its monitoring has a far less busy “scene”. The Frigate/PI installation is monitoring a far busier road it was leading to the cache running out of space.