Viseron v3.0.0b1 - Self-hosted, local only NVR and AI Computer Vision software

Very strange, here is the output of mine:

-rw-r--r-- 1 abc  abc  2457876 Mar 29 10:39 20210329103909.mp4
-rw-r--r-- 1 abc  abc  2549396 Mar 29 10:39 20210329103914.mp4
-rw-r--r-- 1 abc  abc  2385740 Mar 29 10:39 20210329103919.mp4
-rw-r--r-- 1 abc  abc  2545725 Mar 29 10:39 20210329103924.mp4
-rw-r--r-- 1 abc  abc  2359344 Mar 29 10:39 20210329103929.mp4

See how it increments by 5 seconds for each file? Yours increments by several minutes… Will need to think about how this could happen, no idea what is going on here.

Edit: One thing that comes to mind is, ffmpeg can only create segments properly if the stream is creating keyframes at regular intervals. Is this something you can change in your camera settings? See here for more info: https://superuser.com/a/692737

My camera is using variable Bitrate & Zipstream (Axis’s own compression). I disabled Zipstream now.
What’s interesting is that I don’t have recordings (video) in my zone, only screenshots generated in media folder. In case of long movement outside my zone I used to have video recordings.

And still, with configuration you provided, I think I need to mention for camera:

object_detection:
  interval: 0.25
  labels: 
     - label: person
       confidence: 0.4

Because with the one you provided while no label is appointed labels: [] I don’t see labels on detected objects at all. Neither within zone, nor beyond it.
Cars that pass beyond my zone1 are still detected, but now are not labeled.

Hmm okay, but to stop persons from triggering recordings outside of your zone you need

object_detection:
  interval: 0.25
  labels: 
     - label: person
       confidence: 0.4
       triggers_recording: false

With this config I faced the situation when neverending recording began (now recording despite no motion). Viseron “sees” standing cars and detects them, and recording never stops…

# See the README for the full list of configuration options.
cameras:
  - name: FrontYard
    host: 192.168.0.4
    port: 554
    username: root
    password: pass
    path: /axis-media/media.amp?streamprofile=viseron
    publish_image: true
    fps: 10
    motion_detection:
      area: 0.02
      interval: 0.25
      threshold: 3
      trigger_detector: true
      timeout: true
      max_timeout: 5
    zones:
      - name: zone1
        points:
          - x: 1715
            y: 343
          - x: 1788
            y: 399
          - x: 1920
            y: 589
          - x: 1920
            y: 1075         
          - x: 0
            y: 1077
          - x: 0
            y: 612
          - x: 203
            y: 306
          - x: 415
            y: 248
          - x: 761
            y: 195
          - x: 1091
            y: 187           
          - x: 1339
            y: 204
          - x: 1529
            y: 229
        labels:
          - label: person
            confidence: 0.4
          - label: car
            confidence: 0.7
    object_detection:
      interval: 0.25
      labels:
        - label: person
          confidence: 0.4
        - label: car
          confidence: 0.7
object_detection:
  interval: 0.25
  labels: []
  triggers_recording: false
recorder:
  lookback: 2
  timeout: 3
  retain: 3
  folder: /recordings
 # MQTT is optional
mqtt:
  broker: 192.168.0.3
  port: 1883
  username: Max
  password: pass
logging:
  level: debug

Logs:

[2021-03-29 13:15:22] [lib.nvr.frontyard       ] [DEBUG   ] - NVR thread initialized
[2021-03-29 13:15:22] [lib.nvr.frontyard       ] [DEBUG   ] - Waiting for first frame
[2021-03-29 13:15:22] [root                    ] [INFO    ] - Initialization complete
[2021-03-29 13:15:22] [lib.camera.frontyard    ] [DEBUG   ] - Running object detection at 0.25s interval, every 2 frame(s)
[2021-03-29 13:15:22] [lib.camera.frontyard    ] [DEBUG   ] - Running motion detection at 0.25s interval, every 2 frame(s)
[2021-03-29 13:15:22] [lib.mqtt                ] [DEBUG   ] - MQTT connected with returncode 0
[2021-03-29 13:15:22] [lib.mqtt                ] [DEBUG   ] - Got topic viseron/frontyard/switch/set, message ON
[2021-03-29 13:15:53] [lib.nvr.frontyard       ] [DEBUG   ] - First frame received
[2021-03-29 13:25:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 1, max area size: 0.02065
[2021-03-29 13:25:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 2, max area size: 0.02194
[2021-03-29 13:25:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 3, max area size: 0.02349
[2021-03-29 13:25:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Motion detected
[2021-03-29 13:25:28] [lib.nvr.frontyard       ] [DEBUG   ] - Starting object detector
[2021-03-29 13:25:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 4, max area size: 0.02534
[2021-03-29 13:25:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 5, max area size: 0.02697
[2021-03-29 13:25:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 6, max area size: 0.02815
[2021-03-29 13:25:29] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 7, max area size: 0.0294
[2021-03-29 13:25:29] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 8, max area size: 0.03068
[2021-03-29 13:25:29] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 9, max area size: 0.03151
[2021-03-29 13:25:30] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 10, max area size: 0.03222
[2021-03-29 13:25:30] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 11, max area size: 0.03244
[2021-03-29 13:25:30] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 12, max area size: 0.03246
[2021-03-29 13:25:30] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 13, max area size: 0.03207
[2021-03-29 13:25:30] [lib.camera.frontyard    ] [WARNING ] - object_detection input queue is full. Removing oldest entry
[2021-03-29 13:25:31] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 14, max area size: 0.0316
[2021-03-29 13:25:31] [lib.recorder.frontyard  ] [INFO    ] - Starting recorder
[2021-03-29 13:25:31] [lib.cleanup             ] [DEBUG   ] - Pausing segment cleanup
[2021-03-29 13:25:31] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 15, max area size: 0.031
[2021-03-29 13:25:31] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 16, max area size: 0.0299
[2021-03-29 13:25:31] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 17, max area size: 0.02889
[2021-03-29 13:25:31] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 18, max area size: 0.02779
[2021-03-29 13:25:32] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 19, max area size: 0.02627
[2021-03-29 13:25:32] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 20, max area size: 0.02073
[2021-03-29 13:25:32] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 21, max area size: 0.02001
[2021-03-29 13:25:32] [lib.nvr.frontyard.motion] [DEBUG   ] - Motion stopped
[2021-03-29 13:26:19] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 1, max area size: 0.02098
[2021-03-29 13:26:19] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 2, max area size: 0.02213
[2021-03-29 13:26:19] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 3, max area size: 0.02313
[2021-03-29 13:26:19] [lib.nvr.frontyard.motion] [DEBUG   ] - Motion detected
[2021-03-29 13:26:19] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 4, max area size: 0.02431
[2021-03-29 13:26:20] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 5, max area size: 0.02586
[2021-03-29 13:26:20] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 6, max area size: 0.02738
[2021-03-29 13:26:20] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 7, max area size: 0.02847
[2021-03-29 13:26:20] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 8, max area size: 0.02997
[2021-03-29 13:26:20] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 9, max area size: 0.03143
[2021-03-29 13:26:21] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 10, max area size: 0.03309
[2021-03-29 13:26:21] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 11, max area size: 0.03446
[2021-03-29 13:26:21] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 12, max area size: 0.03523
[2021-03-29 13:26:21] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 13, max area size: 0.03678
[2021-03-29 13:26:21] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 14, max area size: 0.03756
[2021-03-29 13:26:22] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 15, max area size: 0.03926
[2021-03-29 13:26:22] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 16, max area size: 0.04114
[2021-03-29 13:26:22] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 17, max area size: 0.04266
[2021-03-29 13:26:22] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 18, max area size: 0.04469
[2021-03-29 13:26:22] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 19, max area size: 0.04584
[2021-03-29 13:26:23] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 20, max area size: 0.04786
[2021-03-29 13:26:23] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 21, max area size: 0.04968
[2021-03-29 13:26:23] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 22, max area size: 0.05169
[2021-03-29 13:26:23] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 23, max area size: 0.0526
[2021-03-29 13:26:23] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 24, max area size: 0.05423
[2021-03-29 13:26:24] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 25, max area size: 0.05542
[2021-03-29 13:26:24] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 26, max area size: 0.05663
[2021-03-29 13:26:24] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 27, max area size: 0.05742
[2021-03-29 13:26:24] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 28, max area size: 0.05817
[2021-03-29 13:26:24] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 29, max area size: 0.05844
[2021-03-29 13:26:25] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 30, max area size: 0.05688
[2021-03-29 13:26:25] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 31, max area size: 0.05714
[2021-03-29 13:26:25] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 32, max area size: 0.05748
[2021-03-29 13:26:25] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 33, max area size: 0.05638
[2021-03-29 13:26:25] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 34, max area size: 0.05618
[2021-03-29 13:26:26] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 35, max area size: 0.05574
[2021-03-29 13:26:26] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 36, max area size: 0.05462
[2021-03-29 13:26:26] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 37, max area size: 0.05303
[2021-03-29 13:26:26] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 38, max area size: 0.05272
[2021-03-29 13:26:26] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 39, max area size: 0.05236
[2021-03-29 13:26:27] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 40, max area size: 0.05278
[2021-03-29 13:26:27] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 41, max area size: 0.05172
[2021-03-29 13:26:27] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 42, max area size: 0.05032
[2021-03-29 13:26:27] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 43, max area size: 0.04884
[2021-03-29 13:26:27] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 44, max area size: 0.04641
[2021-03-29 13:26:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 45, max area size: 0.04501
[2021-03-29 13:26:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 46, max area size: 0.04193
[2021-03-29 13:26:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 47, max area size: 0.04069
[2021-03-29 13:26:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 48, max area size: 0.03869
[2021-03-29 13:26:28] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 49, max area size: 0.03781
[2021-03-29 13:26:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 50, max area size: 0.03607
[2021-03-29 13:26:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 51, max area size: 0.03402
[2021-03-29 13:26:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 52, max area size: 0.03217
[2021-03-29 13:26:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 53, max area size: 0.03162
[2021-03-29 13:26:29] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 54, max area size: 0.02949
[2021-03-29 13:26:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 55, max area size: 0.02812
[2021-03-29 13:26:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 56, max area size: 0.02657
[2021-03-29 13:26:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 57, max area size: 0.02518
[2021-03-29 13:26:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 58, max area size: 0.02334
[2021-03-29 13:26:30] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 59, max area size: 0.02175
[2021-03-29 13:26:31] [lib.nvr.frontyard.motion] [DEBUG   ] - Motion stopped
[2021-03-29 13:34:09] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 1, max area size: 0.02007
[2021-03-29 13:34:09] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 2, max area size: 0.02302
[2021-03-29 13:34:09] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 3, max area size: 0.02581
[2021-03-29 13:34:09] [lib.nvr.frontyard.motion] [DEBUG   ] - Motion detected
[2021-03-29 13:34:09] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 4, max area size: 0.02849
[2021-03-29 13:34:09] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 5, max area size: 0.03173
[2021-03-29 13:34:10] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 6, max area size: 0.03242
[2021-03-29 13:34:10] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 7, max area size: 0.03741
[2021-03-29 13:34:10] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 8, max area size: 0.04048
[2021-03-29 13:34:10] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 9, max area size: 0.04439
[2021-03-29 13:34:10] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 10, max area size: 0.04735
[2021-03-29 13:34:11] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 11, max area size: 0.05081
[2021-03-29 13:34:11] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 12, max area size: 0.05331
[2021-03-29 13:34:11] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 13, max area size: 0.05415
[2021-03-29 13:34:11] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 14, max area size: 0.04651
[2021-03-29 13:34:11] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 15, max area size: 0.04459
[2021-03-29 13:34:12] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 16, max area size: 0.04437
[2021-03-29 13:34:12] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 17, max area size: 0.04389
[2021-03-29 13:34:12] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 18, max area size: 0.04359
[2021-03-29 13:34:12] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 19, max area size: 0.03636
[2021-03-29 13:34:12] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 20, max area size: 0.03512
[2021-03-29 13:34:13] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 21, max area size: 0.03558
[2021-03-29 13:34:13] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 22, max area size: 0.03512
[2021-03-29 13:34:13] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 23, max area size: 0.03373
[2021-03-29 13:34:13] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 24, max area size: 0.03118
[2021-03-29 13:34:13] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 25, max area size: 0.02966
[2021-03-29 13:34:14] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 26, max area size: 0.02769
[2021-03-29 13:34:14] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 27, max area size: 0.02304
[2021-03-29 13:34:14] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 28, max area size: 0.02192
[2021-03-29 13:34:14] [lib.nvr.frontyard.motion] [DEBUG   ] - Consecutive frames with motion: 29, max area size: 0.02119
[2021-03-29 13:34:14] [lib.nvr.frontyard.motion] [DEBUG   ] - Motion stopped

Again, this is not within my Zone… Looks like recorder reacts to object_detection settings set for Camera (and corresponding zone), but records all screen.

When I see logs I still notice:


[2021-03-29 14:31:25] [lib.recorder.frontyard  ] [ERROR   ] - Could not get duration for: /segments/FrontYard/20210329143113.mp4. Error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x55abe9102b00] moov atom not found
/segments/FrontYard/20210329143113.mp4: Invalid data found when processing input

No matter how hard I tried, only selected Zone recordng & object detection doesn’t work :(…

I’m gonna run some tests, ill get back to you. What you’re trying to achieve should be possible.

For me this config works. As soon as i enter my zone the recording starts. When i leave the zone the recording stops

cameras:
  - name: Uteplats
    mqtt_name: ....
    host: ....
    port: ....
    username: ....
    password: ....
    path: /Streaming/Channels/101/
    width: 1920
    height: 1080
    fps: 6
    logging:
      level: debug
    zones:
      - name: zone1
        points:
          - x: 0
            y: 500
          - x: 1920
            y: 500
          - x: 1920
            y: 1080
          - x: 0
            y: 1080
        labels:
          - label: person
            confidence: 0.7
            triggers_recording: true
    publish_image: true

    # This is probably the part you are missing
    object_detection:
      interval: 1
      labels:
        - label: person
          triggers_recording: false
      logging:
        level: debug
      log_all_objects: true


motion_detection:
  interval: 1
  timeout: true
  trigger_detector: true

object_detection:
  interval: 1
  labels:
    - label: person
      triggers_recording: false

recorder:
  lookback: 10
  timeout: 20

logging:
  level: debug

The difference between my config and yours is the object_detection block under the camera.

I cant do anything about your issues with the segments though, that is entirely handled by ffmpeg and if it cant create the segments properly you need to tweak your camera to send more frequent keyframes.

1 Like

Finally, it works! Thanks! It was not easy to guess the sequence of parameters to make it work as I wanted :slight_smile:

But still have no idea what setting in my cam I need to adjust to avoid this:
[2021-03-30 14:28:13] [lib.recorder.frontyard ] [DEBUG ] - Concatenating segments [2021-03-30 14:28:13] [lib.recorder.frontyard ] [DEBUG ] - /segments/FrontYard/20210330142812.mp4 is locked. Trying again in 1 second [2021-03-30 14:28:13] [lib.nvr.frontyard ] [DEBUG ] - Not recording, pausing object detector [2021-03-30 14:28:24] [lib.recorder.frontyard ] [DEBUG ] - /segments/FrontYard/20210330142812.mp4 is locked. Trying again in 1 second, message repeated 10 times [2021-03-30 14:28:25] [lib.recorder.frontyard ] [ERROR ] - Could not get duration for: /segments/FrontYard/20210330142812.mp4. Error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x555a05e4bb00] moov atom not found /segments/FrontYard/20210330142812.mp4: Invalid data found when processing input

Same thing for another camera (both are working perfectly with NVR, Milestone XProtect, and so on). What can FFMPEG dislike?


[2021-03-30 14:36:49] [lib.recorder.backyard   ] [DEBUG   ] - Creating folder /recordings/2021-03-30/BackYard
[2021-03-30 14:36:49] [lib.nvr.backyard.motion ] [DEBUG   ] - Motion stopped
[2021-03-30 14:36:55] [lib.nvr.backyard        ] [INFO    ] - Stopping recording in: 2
[2021-03-30 14:36:56] [lib.nvr.backyard        ] [INFO    ] - Stopping recording in: 1
[2021-03-30 14:36:57] [lib.nvr.backyard        ] [INFO    ] - Stopping recording in: 0
[2021-03-30 14:36:57] [lib.recorder.backyard   ] [INFO    ] - Stopping recorder
[2021-03-30 14:36:57] [lib.recorder.backyard   ] [DEBUG   ] - Concatenating segments
[2021-03-30 14:36:57] [lib.recorder.backyard   ] [DEBUG   ] - /segments/BackYard/20210330143641.mp4 is locked. Trying again in 1 second
[2021-03-30 14:36:57] [lib.nvr.backyard        ] [DEBUG   ] - Not recording, pausing object detector
[2021-03-30 14:37:07] [lib.recorder.backyard   ] [DEBUG   ] - /segments/BackYard/20210330143641.mp4 is locked. Trying again in 1 second, message repeated 10 times
[2021-03-30 14:37:08] [lib.recorder.backyard   ] [ERROR   ] - Could not get duration for: /segments/BackYard/20210330143641.mp4. Error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5619c4417b00] moov atom not found
/segments/BackYard/20210330143641.mp4: Invalid data found when processing input

[2021-03-30 14:37:08] [lib.recorder.backyard   ] [DEBUG   ] - Segment information: {}
[2021-03-30 14:37:08] [lib.recorder.backyard   ] [ERROR   ] - No segments were found
[2021-03-30 14:37:08] [lib.cleanup             ] [DEBUG   ] - Resuming segment cleanup

Looks like there’s some issue between FFMPEG & H264 streams.
Now I switched BackYard cam to MJPEG and segments operation is OK, while FrontYard is still in H264, and there are issues…


[2021-03-30 14:58:14] [lib.recorder.frontyard  ] [DEBUG   ] - /segments/FrontYard/20210330145753.mp4 is locked. Trying again in 1 second, message repeated 11 times
[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [ERROR   ] - Could not get duration for: /segments/FrontYard/20210330145753.mp4. Error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x562bbb667b00] moov atom not found
/segments/FrontYard/20210330145753.mp4: Invalid data found when processing input

[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [DEBUG   ] - Segment information: {'20210330145723.mp4': {'start_time': 1617105443.0, 'end_time': 1617105472.946}}
[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [WARNING ] - Could not find matching end segment. Using latest possible
[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [DEBUG   ] - Start event: 1617105456, segment: 20210330145723.mp4
[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [DEBUG   ] - End event: 1617105483, segment: 20210330145723.mp4
[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [DEBUG   ] - Concatenation command: ['ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', '-protocol_whitelist', 'file,pipe', '-f', 'concat', '-safe', '0', '-i', '-', '-c:v', 'copy', '-movflags', '+faststart', '/recordings/2021-03-30/FrontYard/14:57:38.mp4']
[2021-03-30 14:58:15] [lib.recorder.frontyard  ] [DEBUG   ] - Segment script:
file '/segments/FrontYard/20210330145723.mp4'
inpoint 13
outpoint 40

But H264 file size is much smaller. Maybe I need to add some parameter to FFMPEG to avoid this error?

@roflcoopter

Can it be the problem of FFMPEG itself? Maybe it needs to be recompiled?
I am using 4 cameras, and result is all same. I fixed “P-frames” (Keyframes), nothing affects the error.

I googled moov atom not found and every occasion is linked with corrupted MP4 source, in my case it does not look like unreadbale, though in Media Player it’s impossible to jump to specific time in the timeline.

I am using h264 streams and those are working fine for me.

whats the output of ffprobe -loglevel error -skip_frame nokey -select_streams v:0 -show_entries frame=pkt_pts_time -of csv=print_section=0 <rtsp://your_camera_url_here> ?

Let it run for a while and send me the timestamps.

Edit: Also, P-frames is not the same as keyframes as per my understanding. You should look for I-frames. I dont own Axis cameras but google suggests changing a setting called GOP

Here is the result:

0.000000
5.079989
10.199978
15.279967
20.399956
25.479944
30.599933
35.679922
40.799900
45.879889
50.999878
56.079867
61.199856
66.279844
71.399833
76.479822
81.599811
86.679800
91.799789
96.879778
101.999767
107.079744
112.199733
117.279722
122.399711
127.479700
132.599689
137.679678
142.799667
147.879656
152.999644
158.079633
163.199611
168.279600
173.399589
178.479578

Tried with Dynamic GOP and static - not influencing the error.

Okay, that looks fine since it prints every 5 sec. Whats the model of your camera?

2 cams Axis P1368E and other 2 are Axis M2026-LE Mk II
I’ve set GOP to 50 fixed, now it prints even more ideal Key frames. I’ll monitor what comes back in Debug:

0.000000
4.999989
9.999978
14.999967
19.999956
24.999933
29.999922
34.999911
39.999900
44.999889
49.999878
54.999867
59.999856
64.999844
69.999833
74.999822
79.999811
84.999800
89.999789
94.999767
99.999756
104.999744
109.999733
114.999722
119.999711
124.999700
129.999689
134.999678
139.999667
144.999656
149.999644
154.999633

Interesting fact is that sometimes (more often) segments are concatenated without problems, but from time to time I get the ERROR as above for the same camera. Can’t understand the reason…

does it properly output 5 second segments if you exec into the container and run ffmpeg -hide_banner -loglevel info -c:v h264_cuvid -rtsp_transport tcp -i rtsp://root:[email protected]:554/axis-media/media.amp?streamprofile=viseron -f segment -segment_time 5 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /segments/FrontYard/%Y%m%d%H%M%S.mp4 ?

for me, this is the output:

[segment @ 0x55ca71146980] Opening '/segments/Uteplats/20210331170359.mp4' for writing
[segment @ 0x55ca71146980] Opening '/segments/Uteplats/20210331170404.mp4' for writing
[segment @ 0x55ca71146980] Opening '/segments/Uteplats/20210331170409.mp4' for writing
[segment @ 0x55ca71146980] Opening '/segments/Uteplats/20210331170414.mp4' for writing
[segment @ 0x55ca71146980] Opening '/segments/Uteplats/20210331170419.mp4' for writing
frame=  176 fps=7.1 q=-1.0 Lsize=N/A time=00:00:28.15 bitrate=N/A speed=1.14x    
video:14161kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.

In my case it doesn’t work (maybe parameters are wrong?):


  Metadata:
    title           : Session streamed with GStreamer
    comment         : rtsp-server
  Duration: N/A, start: 0.600000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 10 fps, 10 tbr, 90k tbn, 20 tbc
[segment @ 0x5654fc2cd500] Opening '/segments/FrontYard/20210331205709.mp4' for writing
[segment @ 0x5654fc2cd500] Failed to open segment '/segments/FrontYard/20210331205709.mp4'
Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
    Last message repeated 1 times

Tried with different cameras, - same.

Maybe try changing -rtsp_transport tcp to rtsp_transport udp?
You can also turn up the logging of ffmpeg to debug and see if that gives you better information.

You’re gonna have to play around with the ffmpeg command til you find whats causing it, i cant be of much help since i dont have access to your camera unfortunately

@roflcoopter
Found one peculiarity in Viseron.
When motion is discovered within a Zone (in my case it’s moving IR light from PTZ Camera) and simultaneously a person (in my case it’s an object of interest) is discovered beyond Zone, an object trigger starts and I see MQTT notification (and recorder starts). It does not happen in 100% cases, but in evening time I notice such behavior more & more.

P.S> Could you please specify how you grab picture of particular Zone (in my case with Person detected) and send notification with it? In my case I plan to use notify.telegram.

Object detection will always run on the entire frame, regardless of which zone the motion is registered in.

Right now you cant grab a picture of the zone, but this can probably be added. I would appreciate it if you could open a feature request on gothub so i can track it more easily

OK, I will, thanks!
I’m OK with the picture of entire frame. Would you please explain how you use automation to send the picture of entire frame when object detection is triggered in my Zone of interest?
I’m about to use Telegram notification to send me the picture, in particular.
Thanks!