koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
4.27k stars 252 forks source link

Python Codec High CPU and Memory Utilization #743

Closed jcannon23 closed 1 year ago

jcannon23 commented 1 year ago

The Python Codec is using a large amount of CPU and Memory resources and has been causing my machine to crash.

image

koush commented 1 year ago

Can you check how many python processes you have running

ps aux | grep -i python | wc -l

jcannon23 commented 1 year ago

I have 10 python processes running

koush commented 1 year ago

how many cameras?

jcannon23 commented 1 year ago

7 cameras

Roarrk commented 1 year ago

Same issue here, this is shortly after a python codecs update that reset the cpu use. 6 cameras.

image

koush commented 1 year ago

This is normal. All decoding and memory usage is offloaded onto that plugin which will tear down the processes, freeing everything. Nothing else uses CPU or memory now.

madmax commented 1 year ago

@koush I upgraded from 0.44 and there was almost no cpu usage, Now python is at 50% cpu all the time.

image
jcannon23 commented 1 year ago

Echo'ing @madmax, in prior releases, my CPU and memory utilization were much lower. This is a recent development.

Roarrk commented 1 year ago

Same here - was "down" to 30-50 cpu on some of the threads. After this last update I am getting several threads spiking intermittently at 150+ cpu and stalling the mac entirely.

koush commented 1 year ago

Please let me know which motion detector is being used.

jcannon23 commented 1 year ago

@Koush PAM Diff Motion Detection

koush commented 1 year ago

I'll maybe look into it at some point. Use OpenCV instead, that's preferred to PAM diff (which I dont plan on maintaining much further due to native builds/dependencies). Or upgrade to the supported Scrypted (+optional NVR) app which has a custom GPU accelerated motion sensor. https://github.com/koush/nvr.scrypted.app/releases