Closed JoeGandy closed 4 years ago
Ahh, looks like i have not accounted for cameras without authentication... Can you enable debug logging and paste me the full ffmpeg decoder command?
logging:
level: debug
Thanks for the quick reply!
[2020-09-04 08:45:51] [lib.camera.front_room ] [DEBUG ] - FFMPEG decoder command: ffmpeg -hide_banner -loglevel error -loglevel panic -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -stimeout 5000000 -use_wallclock_as_timestamps 1 -vsync 0 -rtsp_transport tcp -i rtsp://test:test@192.168.1.111:6082/ -f rawvideo -pix_fmt nv12 pipe:1
As a test I enabled authentication in motion eye, but still no luck
I dont have an MJPEG camera to work with so i will need some help verifying the issue if thats okay. Can you run this for me and show me the output?
docker exec -it viseron ffmpeg -hide_banner -f mjpeg -i http://test:test@192.168.1.111:6082/ -f null /dev/null
Sure no worries, seems to run fine
|||||||||||||||:~# docker exec -it viseron ffmpeg -hide_banner -f mjpeg -i http://test:test@192.168.1.111:6082/ -f null /dev/null Input #0, mjpeg, from 'http://test:test@192.168.1.111:6082/': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 800x480 [SAR 1:1 DAR 5:3], 25 tbr, 1200k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> wrapped_avframe (native)) Press [q] to stop, [?] for help Output #0, null, to '/dev/null': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: wrapped_avframe, yuvj420p, 800x480 [SAR 1:1 DAR 5:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 wrapped_avframe frame= 442 fps= 20 q=-0.0 size=N/A time=00:00:17.68 bitrate=N/A speed=0.802x
Great! Could you try without the -f mjpeg
aswell?
docker exec -it viseron ffmpeg -hide_banner -i http://test:test@192.168.1.111:6082/ -f null /dev/null
Assuming you mean -f mpjeg
to be removed :)
||||||||:~# docker exec -it viseron ffmpeg -hide_banner -i http://test:test@192.168.1.111:6082/ -f null /dev/null Input #0, mpjpeg, from 'http://test:test@192.168.1.111:6082/': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 800x480 [SAR 1:1 DAR 5:3], 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> wrapped_avframe (native)) Press [q] to stop, [?] for help Output #0, null, to '/dev/null': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: wrapped_avframe, yuvj420p, 800x480 [SAR 1:1 DAR 5:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc57.107.100 wrapped_avframe frame= 192 fps= 20 q=-0.0 size=N/A time=00:00:07.68 bitrate=N/A speed=0.807x
Yes thats what i meant... Thanks, I will do the necessarry fixes and push to a dev branch for you to try out. You are running the generic image yes?
Yeah I just grabbed it from docker hub through the app page on unraid, so not quite sure how to test the dev branches!
not sure how unraid works but i will push roflcoopter/viseron-generic:dev. Can you pick the tag or does it always just grab latest?
I think i might be able to specify a tag, i'll give it a shot :)
I'll try roflcoopter/viseron:dev
now
its not up yet! ill let you know when it is.
Okay I can confirm i can get to the different tags :) I tested with pulling roflcoopter/viseron:1.2.0
which worked, so give me a shout when :dev is good to go
Thanks! sorry was a bit keen!
it is up now under roflcoopter/viseron:dev
.
you need to add stream_format: mjpeg
to your camera configuration.
As i said earlier, i sadly dont have an mjpeg camera to test with so its untested to say the least
It's looking to be getting better,still stimeout issue, but im not sure what this means?
[2020-09-04 09:38:20] [lib.camera.front_room ] [INFO ] - Resolution: 640x360 @ 15 FPS [2020-09-04 09:38:20] [lib.camera.front_room ] [DEBUG ] - FFMPEG decoder command: ffmpeg -hide_banner -loglevel error -loglevel panic -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -stimeout 5000000 -use_wallclock_as_timestamps 1 -vsync 0 -i http://test:test@192.168.1.111:6082/ -f rawvideo -pix_fmt nv12 pipe:1 [2020-09-04 09:38:20] [lib.camera.front_room ] [DEBUG ] - Starting capture process [2020-09-04 09:38:20] [lib.camera.front_room ] [DEBUG ] - Starting decoder thread [2020-09-04 09:38:20] [lib.recorder ] [DEBUG ] - Initializing ffmpeg recorder [2020-09-04 09:38:20] [lib.recorder ] [DEBUG ] - FFMPEG encoder command: ffmpeg -hide_banner -loglevel panic -f rawvideo -pix_fmt nv12 -s:v
x -r -i pipe:0 -y [2020-09-04 09:38:20] [lib.nvr.front_room ] [DEBUG ] - NVR thread initialized [2020-09-04 09:38:20] [lib.nvr.front_room ] [DEBUG ] - Waiting for first frame [2020-09-04 09:38:20] [root ] [INFO ] - Initialization complete [2020-09-04 09:38:21] [lib.camera.front_room ] [ERROR ] - Error starting decoder pipe! Option stimeout not found. [2020-09-04 09:38:21] [lib.camera.front_room ] [ERROR ] - Error starting decoder pipe! Option stimeout not found.
Happy to keep debugging fyi :)
Okay, guess the input parameters are not available for mjpeg streams. Can you run
docker exec -it viseron ffmpeg -hide_banner -loglevel error -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -i http://test:test@192.168.1.111:6082/ -f null /dev/null
and see if there are any other offending flags? This way i dont have to keep pushing dev for you to find out some other flag is causing issues aswell
Seems to be happy, dont get any ouput from the command
great! You can set the input arguments for each camera through the config.yaml, like this
input_args:
- -avoid_negative_ts
- make_zero
- -fflags
- nobuffer
- -flags
- low_delay
- -strict
- experimental
- -fflags
- +genpts
- -use_wallclock_as_timestamps
- 1
- -vsync
- 0
try that and see if it works
Hey, that's working now
[2020-09-04 10:29:08] [root ] [INFO ] - ------------------------------------------- [2020-09-04 10:29:08] [root ] [INFO ] - Initializing... [2020-09-04 10:29:08] [root ] [DEBUG ] - Starting cleanup scheduler [2020-09-04 10:29:08] [root ] [DEBUG ] - Running initial cleanup [2020-09-04 10:29:08] [lib.cleanup ] [DEBUG ] - Running cleanup [2020-09-04 10:29:08] [lib.mqtt ] [INFO ] - Initializing MQTT connection [2020-09-04 10:29:08] [lib.detector ] [INFO ] - Initializing detection thread [2020-09-04 10:29:08] [root ] [INFO ] - Initializing NVR threads [2020-09-04 10:29:08] [lib.nvr.front_room ] [DEBUG ] - Initializing NVR thread [2020-09-04 10:29:08] [lib.camera.front_room ] [DEBUG ] - Initializing ffmpeg RTSP pipe [2020-09-04 10:29:08] [lib.camera.front_room ] [INFO ] - Resolution: 640x360 @ 15 FPS [2020-09-04 10:29:08] [lib.camera.front_room ] [DEBUG ] - FFMPEG decoder command: ffmpeg -hide_banner -loglevel error -loglevel panic -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts -use_wallclock_as_timestamps 1 -vsync 0 -i http://test:test@192.168.1.111:6082/ -f rawvideo -pix_fmt nv12 pipe:1 [2020-09-04 10:29:08] [lib.camera.front_room ] [DEBUG ] - Starting capture process [2020-09-04 10:29:08] [lib.camera.front_room ] [DEBUG ] - Starting decoder thread [2020-09-04 10:29:08] [lib.recorder ] [DEBUG ] - Initializing ffmpeg recorder [2020-09-04 10:29:08] [lib.recorder ] [DEBUG ] - FFMPEG encoder command: ffmpeg -hide_banner -loglevel panic -f rawvideo -pix_fmt nv12 -s:v
x -r -i pipe:0 -y [2020-09-04 10:29:08] [lib.nvr.front_room ] [DEBUG ] - NVR thread initialized [2020-09-04 10:29:08] [lib.nvr.front_room ] [DEBUG ] - Waiting for first frame [2020-09-04 10:29:08] [root ] [INFO ] - Initialization complete [2020-09-04 10:29:09] [lib.camera.front_room ] [DEBUG ] - Running object detection at 1s interval [2020-09-04 10:29:09] [lib.camera.front_room ] [DEBUG ] - Running motion detection at 1s interval [2020-09-04 10:29:10] [lib.nvr.front_room ] [DEBUG ] - First frame received
I'm still not getting any events through mqtt other than lwt = alive
but im sure thats just some config issues, im going to keep playing around with it :) Thanks a bunch so far!
Hey apologies, just a couple more questions i hope,
I'm getting mqtt data through now, but im not getting any object detections. I get what id expect in the console:
[2020-09-04 13:02:28] [lib.camera.front_room ] [DEBUG ] - Running object detection at 1s interval [2020-09-04 13:02:28] [lib.camera.front_room ] [DEBUG ] - Running motion detection at 1s interval [2020-09-04 13:02:29] [lib.nvr.front_room ] [DEBUG ] - First frame received [2020-09-04 13:08:44] [lib.motion ] [DEBUG ] - Motion frames: 1, area: 175.5 [2020-09-04 13:08:44] [lib.motion ] [DEBUG ] - Motion frames: 2, area: 51912.0 [2020-09-04 13:08:44] [lib.nvr.front_room ] [DEBUG ] - Motion detected! Starting object detector [2020-09-04 13:08:45] [lib.motion ] [DEBUG ] - Motion frames: 3, area: 3781.5 [2020-09-04 13:08:45] [lib.motion ] [DEBUG ] - Motion frames: 4, area: 3052.5 [2020-09-04 13:08:46] [lib.motion ] [DEBUG ] - Motion frames: 5, area: 2691.0 [2020-09-04 13:08:46] [lib.motion ] [DEBUG ] - Motion frames: 6, area: 2639.0 [2020-09-04 13:08:46] [lib.motion ] [DEBUG ] - Motion frames: 7, area: 3486.5 [2020-09-04 13:08:47] [lib.motion ] [DEBUG ] - Motion frames: 8, area: 4360.0 [2020-09-04 13:08:47] [lib.motion ] [DEBUG ] - Motion frames: 9, area: 3429.0 [2020-09-04 13:08:48] [lib.motion ] [DEBUG ] - Motion frames: 10, area: 4331.0 [2020-09-04 13:08:48] [lib.motion ] [DEBUG ] - Motion frames: 11, area: 2369.5 [2020-09-04 13:08:49] [lib.motion ] [DEBUG ] - Motion frames: 12, area: 2193.5 [2020-09-04 13:08:49] [lib.motion ] [DEBUG ] - Motion frames: 13, area: 1583.5 [2020-09-04 13:08:50] [lib.motion ] [DEBUG ] - Motion frames: 14, area: 1245.0 [2020-09-04 13:08:50] [lib.motion ] [DEBUG ] - Motion frames: 15, area: 1043.5 [2020-09-04 13:08:51] [lib.motion ] [DEBUG ] - Motion frames: 16, area: 651.0 [2020-09-04 13:08:51] [lib.motion ] [DEBUG ] - Motion frames: 17, area: 472.0 [2020-09-04 13:08:51] [lib.motion ] [DEBUG ] - Motion frames: 18, area: 738.0 [2020-09-04 13:08:52] [lib.motion ] [DEBUG ] - Motion frames: 19, area: 4241.0 [2020-09-04 13:08:52] [lib.motion ] [DEBUG ] - Motion frames: 20, area: 2740.0 [2020-09-04 13:08:53] [lib.motion ] [DEBUG ] - Motion frames: 21, area: 2429.0 [2020-09-04 13:08:53] [lib.motion ] [DEBUG ] - Motion frames: 22, area: 1739.0 [2020-09-04 13:08:54] [lib.motion ] [DEBUG ] - Motion frames: 23, area: 1464.0 [2020-09-04 13:08:54] [lib.motion ] [DEBUG ] - Motion frames: 24, area: 2008.0 [2020-09-04 13:08:55] [lib.motion ] [DEBUG ] - Motion frames: 25, area: 3259.5 [2020-09-04 13:08:55] [lib.motion ] [DEBUG ] - Motion frames: 26, area: 3926.5 [2020-09-04 13:08:55] [lib.motion ] [DEBUG ] - Motion frames: 27, area: 4439.5 [2020-09-04 13:08:56] [lib.motion ] [DEBUG ] - Motion frames: 28, area: 2607.5 [2020-09-04 13:08:56] [lib.motion ] [DEBUG ] - Motion frames: 29, area: 3043.0 [2020-09-04 13:08:57] [lib.motion ] [DEBUG ] - Motion frames: 30, area: 4267.5 [2020-09-04 13:08:57] [lib.motion ] [DEBUG ] - Motion frames: 31, area: 2067.0 [2020-09-04 13:08:58] [lib.motion ] [DEBUG ] - Motion frames: 32, area: 1072.0 [2020-09-04 13:08:58] [lib.motion ] [DEBUG ] - Motion frames: 33, area: 744.5 [2020-09-04 13:08:59] [lib.motion ] [DEBUG ] - Motion frames: 34, area: 199.5 [2020-09-04 13:08:59] [lib.motion ] [DEBUG ] - Motion frames: 35, area: 97.5 [2020-09-04 13:09:00] [lib.motion ] [DEBUG ] - Motion frames: 36, area: 73.5 [2020-09-04 13:09:00] [lib.motion ] [DEBUG ] - Motion frames: 37, area: 336.0 [2020-09-04 13:09:00] [lib.motion ] [DEBUG ] - Motion frames: 38, area: 223.5 [2020-09-04 13:09:01] [lib.motion ] [DEBUG ] - Motion frames: 39, area: 181.0 [2020-09-04 13:09:01] [lib.motion ] [DEBUG ] - Motion frames: 40, area: 160.5 [2020-09-04 13:09:02] [lib.motion ] [DEBUG ] - Motion frames: 41, area: 249.5 [2020-09-04 13:09:02] [lib.motion ] [DEBUG ] - Motion frames: 42, area: 91.5 [2020-09-04 13:09:03] [lib.motion ] [DEBUG ] - Motion frames: 43, area: 52.5 [2020-09-04 13:09:03] [lib.motion ] [DEBUG ] - Motion frames: 44, area: 24.0 [2020-09-04 13:09:04] [lib.motion ] [DEBUG ] - Motion frames: 45, area: 32.5 [2020-09-04 13:09:04] [lib.motion ] [DEBUG ] - Motion frames: 46, area: 63.5 [2020-09-04 13:09:05] [lib.motion ] [DEBUG ] - Motion frames: 47, area: 46.5 [2020-09-04 13:09:05] [lib.motion ] [DEBUG ] - Motion frames: 48, area: 34.0 [2020-09-04 13:09:05] [lib.motion ] [DEBUG ] - Motion frames: 49, area: 28.5 [2020-09-04 13:09:06] [lib.motion ] [DEBUG ] - Motion has ended [2020-09-04 13:09:06] [lib.nvr.front_room ] [DEBUG ] - Not recording, pausing object detector
But I don't get any recordings saved in the /recordings folder, or any detections in the mqtt data/home assistant sensor. Also the memory usage seems to consistently climb until it uses up everything i've got, I have lookback set to 0, that could be a problem?
Config below (its deliberately really sensitive for testing! :) )
cameras:
- name: front_room
host: 192.168.1.111
port: 6082
path: /
width: 640
height: 360
username: test
password: test
stream_format: mjpeg
fps: 15
input_args:
- "-avoid_negative_ts"
- "make_zero"
- "-fflags"
- "nobuffer"
- "-flags"
- "low_delay"
- "-strict"
- "experimental"
- "-fflags"
- "+genpts"
- "-use_wallclock_as_timestamps"
- "1"
- "-vsync"
- "0"
motion_detection:
interval: 1
trigger: true
area: 10
frames: 2
object_detection:
interval: 1
labels:
- label: person
confidence: 0.1
- label: cat
confidence: 0.1
recorder:
lookback: 0
timeout: 10
retain: 7
folder: /recordings
# MQTT is optional
mqtt:
broker: <removed>
port: <removed>
username: <removed>
password: <removed>
logging:
level: debug
FYI, lookback set to 1 fixed the memory issue atleast! I'm an idiot! still not getting detections :)
Okay i will look at the memory issue when set to 0. Have you tried walking in front of the camera?
I am working on making it easier to debug the detections.
Okay cool, Yeah i think i the lookback is 0 its prob just storing the feed forever in memory. Yep as you can see i get the motion events just fine! Just nothing to debug the object detection, is there a log anywhere for the actual detectors?
Happy to close this issue now, as its getting a bit off topic, and if you're already working on it i can't ask for much more!
Yes its allocation a python queue and when the size is zero it means infinite. Didnt account for this...
If you set trigger: false
under motion detected, are there still no detections?
Nope still nothing, feels like object detection isnt even running, do you have any commands I could try to confirm its even setup right?
There should be errors if there is something wrong. What i need to do is publish some debug information to MQTT for you to inspect, but i wont have time to do that today. I will try to squeeze it in during the weekend. Sorry for the trouble!
Haha no worries! take as long as you need, appreciate the work you've done on this so far, ill keep trying some stuff over the weekend too
Hey, Did you have any luck with this @roflcoopter If i could get some way to debug the actual object dection that'd be awesome.
I can have a look at the unraid template too for you :)
Sorry for taking so long, I am working on zones atm which needed quite a big refactor of the codebase. When this is done images will be sent to MQTT with all objects drawn together with configured zones.
I could push a few debug log statements tomorrow morning so you can see if the detection is running at all.
I just published the first beta for zones.
I also added debug logging of the result for each processed frame by the detector. Here is an example
[2020-09-08 10:00:16] [lib.motion ] [DEBUG ] - Motion frames: 1, area: 768.0
[2020-09-08 10:00:16] [lib.nvr.uteplats ] [DEBUG ] - Motion detected! Starting object detector
[2020-09-08 10:00:16] [lib.nvr.uteplats ] [DEBUG ] - Objects: [{'label': 'pottedplant', 'confidence': 0.224, 'height': 0.062, 'width': 0.065, 'relative_x1': 0.673, 'relative_y1': 0.368, 'relative_x2': 0.738, 'relative_y2': 0.43}]
[2020-09-08 10:00:17] [lib.motion ] [DEBUG ] - Motion frames: 2, area: 2520.5
[2020-09-08 10:00:17] [lib.nvr.uteplats ] [DEBUG ] - Objects: [{'label': 'pottedplant', 'confidence': 0.296, 'height': 0.062, 'width': 0.065, 'relative_x1': 0.675, 'relative_y1': 0.368, 'relative_x2': 0.74, 'relative_y2': 0.43}]
[2020-09-08 10:00:18] [lib.motion ] [DEBUG ] - Motion frames: 3, area: 293.5
[2020-09-08 10:00:18] [lib.nvr.uteplats ] [DEBUG ] - Objects: [{'label': 'pottedplant', 'confidence': 0.233, 'height': 0.06, 'width': 0.067, 'relative_x1': 0.671, 'relative_y1': 0.37, 'relative_x2': 0.738, 'relative_y2': 0.43}]
[2020-09-08 10:00:19] [lib.motion ] [DEBUG ] - Motion frames: 4, area: 996.5
[2020-09-08 10:00:19] [lib.nvr.uteplats ] [DEBUG ] - Objects: []
[2020-09-08 10:00:20] [lib.motion ] [DEBUG ] - Motion frames: 5, area: 1542.5
[2020-09-08 10:00:20] [lib.nvr.uteplats ] [DEBUG ] - Objects: [{'label': 'pottedplant', 'confidence': 0.203, 'height': 0.062, 'width': 0.067, 'relative_x1': 0.675, 'relative_y1': 0.368, 'relative_x2': 0.743, 'relative_y2': 0.43}]
[2020-09-08 10:00:21] [lib.motion ] [DEBUG ] - Motion frames: 6, area: 1498.0
[2020-09-08 10:00:21] [lib.nvr.uteplats ] [DEBUG ] - Objects: []
[2020-09-08 10:00:22] [lib.motion ] [DEBUG ] - Motion frames: 7, area: 1337.5
[2020-09-08 10:00:22] [lib.nvr.uteplats ] [DEBUG ] - Objects: []
I am closing this issue as its gone quite offtopic. Feel free to open a new issue if you still are having issues with the detection
Hey, Might be an obvious one Description of streaming url from motioneye:
I'm given the url in the format
http://192.168.1.111:8082
Initial config for testing:
Then I get
in the docker logs
Do you have any advice for setting this up?