blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.94k stars 1.73k forks source link

[Support]: ERROR: FFMPEG sent broken frame. memoryview assignment: lvalue and rvalue have different structures #2785

Closed jmaack23 closed 2 years ago

jmaack23 commented 2 years ago

Describe the problem you are having

I have been at it for weeks trying to get the dreaded green screen to disappear. I have a Reolink E1 Pro and an Amcrest AD410 doorbell. Only the doorbell is in my configuration because I saw Reolink has some other additional arguments needed, so I wanted to just get this one going first.

I have searched all the different issues that are even remotely close to the issue I'm having. I have tried a lot of suggestions i.e. input args, hardware accelerators, tried different sub-streams and resolutions. I've used VLC to get the correct codec info for my two cameras. The RTSP's work in VLC but from reading, I understand VLC does not use FFMPEG. I am running Frigate-Nvidia on Docker through Unraid. My current config is the closest I can get without receiving other errors for invalid args. I'm hoping that I can get this resolved through here like so many others have.

Version

Screenshot 2022-02-10 092646

Frigate (0.9.4-26ae608)

Frigate config file

mqtt:
![Screenshot 2022-02-10 092747](https://user-images.githubusercontent.com/60854631/153451740-0386b431-19ec-4f05-967e-0863bdde00e2.png)

  host: 192.168.1.182
  port: 1883
  user: mqttuser
  password: [password_here]

cameras:
  doorbell:
    ffmpeg:
      hwaccel_args:
        - -hwaccel
        - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
        - -c:v
        - h264_cuvid
#      input_args:
#       - -c:v
#       - h264_cuvid
      inputs:
        - path: rtsp://viewer:[FRIGATE_PASSWORD_IN_REAL_CONFIG]@192.168.1.54:554/cam/realmonitor?channel=1&subtype=1&authbasic=64
          roles:
            - detect
    detect:
      width: 720
      height: 576
      fps: 5
    rtmp:
      enabled: false

detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
  cpu3:
    type: cpu

Relevant log output

[2022-02-10 08:01:26] frigate.app INFO : Starting Frigate (0.9.4-26ae608)
Starting migrations
[2022-02-10 08:01:26] peewee_migrate INFO : Starting migrations
There is nothing to migrate
[2022-02-10 08:01:26] peewee_migrate INFO : There is nothing to migrate
[2022-02-10 08:01:26] frigate.mqtt INFO : MQTT connected
[2022-02-10 08:01:26] detector.cpu1 INFO : Starting detection process: 233
[2022-02-10 08:01:26] detector.cpu2 INFO : Starting detection process: 234
[2022-02-10 08:01:26] frigate.edgetpu WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-10 08:01:26] detector.cpu3 INFO : Starting detection process: 236
[2022-02-10 08:01:26] frigate.app INFO : Output process started: 238
[2022-02-10 08:01:26] frigate.edgetpu WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-10 08:01:26] frigate.edgetpu WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-10 08:01:26] ws4py INFO : Using epoll
[2022-02-10 08:01:26] frigate.app INFO : Camera processor started for doorbell: 241
[2022-02-10 08:01:26] frigate.app INFO : Capture process started for doorbell: 245
[2022-02-10 08:01:26] frigate.video INFO : doorbell: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2022-02-10 08:01:26] frigate.video INFO : doorbell: ffmpeg process is not running. exiting capture thread...
[2022-02-10 08:01:26] ws4py INFO : Using epoll
[2022-02-10 08:01:29] ws4py INFO : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:56446]
[2022-02-10 08:01:46] watchdog.doorbell ERROR : FFMPEG process crashed unexpectedly for doorbell.
[2022-02-10 08:01:46] watchdog.doorbell ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-02-10 08:01:46] watchdog.doorbell ERROR : You may have invalid args defined for this camera.
[2022-02-10 08:01:46] ffmpeg.doorbell.detect ERROR : [tcp @ 0x564037ba82c0] Port missing in uri
[2022-02-10 08:01:46] ffmpeg.doorbell.detect ERROR : rtsp://viewer:MoTOR0lA#23336@192.168.1.54:554/cam/realmonitor?channel=1&subtype=1&authbasic=64: Invalid argument
[2022-02-10 08:01:46] frigate.video INFO : doorbell: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2022-02-10 08:01:46] frigate.video INFO : doorbell: ffmpeg process is not running. exiting capture thread...
[2022-02-10 08:01:46] watchdog.doorbell ERROR : FFMPEG process crashed unexpectedly for doorbell.
[2022-02-10 08:01:46] watchdog.doorbell ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-02-10 08:01:46] watchdog.doorbell ERROR : You may have invalid args defined for this camera.
[2022-02-10 08:01:46] ffmpeg.doorbell.detect ERROR : [tcp @ 0x564037ba82c0] Port missing in uri
[2022-02-10 08:01:46] ffmpeg.doorbell.detect ERROR : rtsp://viewer:MoTOR0lA#23336@192.168.1.54:554/cam/realmonitor?channel=1&subtype=1&authbasic=64: Invalid argument
[2022-02-10 08:01:46] frigate.video INFO : doorbell: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2022-02-10 08:01:46] frigate.video INFO : doorbell: ffmpeg process is not running. exiting capture thread...
[2022-02-10 08:01:54] ws4py INFO : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:56446]
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-finish] sending all processes the KILL signal and exiting.

FFprobe output from your camera

Can't seem to get this working through the terminal.

Frigate stats

No response

Operating system

UNRAID

Install method

Docker Compose

Coral version

Other

Network connection

Wired

Camera make and model

AMCREST AD410

Any other information that may be helpful

Unrelated to my issue, I have passed one of my two GTX 960's through. GPU's are in SLI mode and were when I purchased the PC. I'm not sure if I need to passthrough both GPU's or not.

I'm a tinkerer, not a full fledged tech guy. I have basic knowledge and have been building that over the past 2.5 years mainly through growing with Home Assistant.

NickM-27 commented 2 years ago

I have the AD410 as well and it works for me with no changes to the args. I added output args to add audio to recordings:

front_doorbell_cam:
    ffmpeg:
      output_args:
        record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
      inputs:
        - path: rtsp://admin:pw@192.168.50.151:554/cam/realmonitor?channel=1&subtype=0&authbasic=64
          roles:
            - record
        - path: rtsp://admin:pw@192.168.50.151:554/cam/realmonitor?channel=1&subtype=1&authbasic=64
          roles:
            - detect

If you are having issues then it is likely due to hw_acceleration args.

In my UNRAID setup I am using an AMD iGPU for hardware acceleration so I am not 100% sure which part may be the issue.

I guess just to confirm, you are running the frigate-nvidia version from the community store and have nvidia drivers installed right?

jmaack23 commented 2 years ago

Thanks @NickM-27 I'll give those args a try in a bit. Along the way, I did come across the audio args, but I couldn't seem to find them again. And yes I am using the Nvidia-frigate version from the community store. I did install the Nvidia add-on as well, which I believe installs the drivers?? And I think the only hardware accelerators I need according to the docs are -c:v and h264_cuvid. I'll try a couple variations there

jmaack23 commented 2 years ago
output_args:
        record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac

Added these args and still get the same errors. I tried those args without the hw accel on and still get the same errors.

NickM-27 commented 2 years ago

Just curious, how did you change the admin to viewer in the URL and are you sure that is correct? Pretty sure it has to be rtsp://admin I guess if that works in VLC perhaps it was changed, just never saw a way to do that.

NickM-27 commented 2 years ago

The only other thing I wonder is if perhaps the # in the password is causing weirdness. Might recommend trying a simpler ASCII password first to see if it works.

jmaack23 commented 2 years ago

Just curious, how did you change the admin to viewer in the URL and are you sure that is correct? Pretty sure it has to be rtsp://admin I guess if that works in VLC perhaps it was changed, just never saw a way to do that.

I was just doing viewer:Frigate Password from the docs...I've tried it with both my normal passwords and the way you see it now, viewer:frigate password doesn't kick back as unauthorized. When I don't use it, it always says "server returned 401 Unauthorized" (authorization failed) in the logs...

NickM-27 commented 2 years ago

Which docs was that in? Can you try it with admin and see if anything changes? I just figure that is one of the few differences between our setups since we both are using unRAID and frigate through docker with the exact same camera.

jmaack23 commented 2 years ago

The only other thing I wonder is if perhaps the # in the password is causing weirdness. Might recommend trying a simpler ASCII password first to see if it works.

Yes, there is a # in my password, and I know in past tries, I've converted it to the right language, but I can't remember what it was and can't find the link now. I think I converted #to %23 according to a wiki doc I found. That seemed to correct any unauthorized errors, but I haven't tried again since you just pointed it out. I don't think I have the right conversion though # # #

jmaack23 commented 2 years ago

Which docs was that in? Can you try it with admin and see if anything changes? I just figure that is one of the few differences between our setups since we both are using unRAID and frigate through docker with the exact same camera.

I'll have to go back and look...It might have came from digiBLUR's example config he pulled from github somewehere now that I think about it.

NickM-27 commented 2 years ago

Okay yeah, I would suggest just starting with the most basic setup possible using the standard admin:basicpassword with the URL above just to rule out that idea or get a baseline and start expanding from there. Never know how ffmpeg will handle these workarounds differently than VLC and it worked with no setup for me just doing the admin:password.

jmaack23 commented 2 years ago

Ok good to know. I'll try it out again. Thanks!

jmaack23 commented 2 years ago

I got it working! I did two things to fix it....One, I went and reset my camera password to exclude any special characters and changed the url to read rtsp://admin:my new password, that fixed my unauthorized 401 error. Second, I went back to the nvidia docs and realized that I had put the h264_cuvid under hardware acc instead of input args. Once I did that, PRESTO, I finally have a working picture in the GUI and all errors are gone. Thank you @NickM-27, you righted the ship for me and got me back to basics after the troubleshooting rabbit hole I went down. It would've been a while before it would've dawned on me to try changing the password.

NickM-27 commented 2 years ago

Awesome! Glad it's working. I have to say this doorbell camera is awesome so enjoy!

jmaack23 commented 2 years ago

Awesome! Glad it's working. I have to say this doorbell camera is awesome so enjoy!

Hell yeah it is. Especially inside Home Assistant and all the sensors you get. Next I gotta get Amcrest2mqtt hooked up because I think there are more sensors available there??

jmaack23 commented 2 years ago

@NickM-27 FYI, here's where I was getting that rtsp://viewer:[FRIGATE_RTSP_PASSWORD] from. That's why I was using the password I set up in Unraid when configuring the container.

https://docs.frigate.video/configuration/index

NickM-27 commented 2 years ago

Oh I see, yeah that is just generic. Also I use Amcrest2mqtt as well and it is great.

jmaack23 commented 2 years ago

I'll be giving it a try for sure.