frigate icon indicating copy to clipboard operation
frigate copied to clipboard

[Camera Support]: Unable to read frames from ffmpeg process. (Invalid Data) When Camera Shutter Speed set too slow

Open LckySndays opened this issue 2 years ago • 7 comments

Describe the problem you are having

Whenever I set shutter speed of my CCTV to 1/3, frigate will show this error every first start and keep restarting the process and failed

2023-01-23 00:07:20.322920412  [2023-01-23 00:07:20] frigate.video                  ERROR   : TestCam1: Unable to read frames from ffmpeg process.
2023-01-23 00:07:20.322937170  [2023-01-23 00:07:20] frigate.video                  ERROR   : TestCam1: ffmpeg process is not running. exiting capture thread...
2023-01-23 00:07:35.220245238  [2023-01-23 00:07:35] watchdog.TestCam1              ERROR   : Ffmpeg process crashed unexpectedly for TestCam1.
2023-01-23 00:07:35.220486605  [2023-01-23 00:07:35] watchdog.TestCam1              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-01-23 00:07:35.220705867  [2023-01-23 00:07:35] ffmpeg.TestCam1.detect         ERROR   : rtsp://127.0.0.1:8554/TestCam1: Invalid data found when processing input

When I changed the CCTV shutter speed to 1/6 or 1/12 on other camera, the error disappear and camera image working fine even when I change it back later on to 1/3.

The error only occurred everytime the frigate starting up when the camera shutter speed set to 1/3 My temporary solution is to set shutter speed to faster value temporary until the frigate error disappear and set it back

Version

0.12.0-12d51d3

Frigate config file

mqtt:
  enabled: False
  
birdseye:
  enabled: False
  
detect:
  enabled: False

go2rtc:
  streams:
    TestCam1: ffmpeg:rtsp://user:[email protected]/Streaming/Channels/101
  webrtc:
    candidates:
      - 10.54.99.109:8555
      - stun:8555
      
cameras:
  TestCam1:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/TestCam1
          roles:
            - restream
          hwaccel_args: preset-nvidia-h265
          input_args: preset-rtsp-restream

Relevant log output

2023-01-23 00:07:15.198540169  [2023-01-23 00:07:15] frigate.app                    INFO    : Starting Frigate (0.12.0-12d51d3)
2023-01-23 00:07:15.202570891  [2023-01-23 00:07:15] peewee_migrate                 INFO    : Starting migrations
2023-01-23 00:07:15.204114751  [2023-01-23 00:07:15] peewee_migrate                 INFO    : There is nothing to migrate
2023-01-23 00:07:15.204726727  [2023-01-23 00:07:15] ws4py                          INFO    : Using epoll
2023-01-23 00:07:15.208818920  [2023-01-23 00:07:15] frigate.app                    INFO    : Output process started: 1257
2023-01-23 00:07:15.209239532  [2023-01-23 00:07:15] detector.cpu                   INFO    : Starting detection process: 1256
2023-01-23 00:07:15.210580497  [2023-01-23 00:07:15] ws4py                          INFO    : Using epoll
2023-01-23 00:07:15.210613816  [2023-01-23 00:07:15] frigate.detectors              WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
2023-01-23 00:07:15.211371882  [2023-01-23 00:07:15] frigate.app                    INFO    : Camera processor started for TestCam1: 1262
2023-01-23 00:07:15.211479078  [2023-01-23 00:07:15] frigate.app                    INFO    : Capture process started for TestCam1: 1264
2023-01-23 00:07:15.453144504  [2023-01-23 00:07:15] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38266]
2023-01-23 00:07:15.907835919  [2023-01-23 00:07:15] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38266]
2023-01-23 00:07:15.946976841  [2023-01-23 00:07:15] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38276]
2023-01-23 00:07:16.257328135  [2023-01-23 00:07:16] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38276]
2023-01-23 00:07:16.293466891  [2023-01-23 00:07:16] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38278]
2023-01-23 00:07:16.527583626  [2023-01-23 00:07:16] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38278]
2023-01-23 00:07:16.573033380  [2023-01-23 00:07:16] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38282]
2023-01-23 00:07:16.788341786  [2023-01-23 00:07:16] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38282]
2023-01-23 00:07:16.824972482  [2023-01-23 00:07:16] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38290]
2023-01-23 00:07:17.023734355  [2023-01-23 00:07:17] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38290]
2023-01-23 00:07:17.066751117  [2023-01-23 00:07:17] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38298]
2023-01-23 00:07:17.298910889  [2023-01-23 00:07:17] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38298]
2023-01-23 00:07:17.333097754  [2023-01-23 00:07:17] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38306]
2023-01-23 00:07:17.603436833  [2023-01-23 00:07:17] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38306]
2023-01-23 00:07:17.626853201  [2023-01-23 00:07:17] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38310]
2023-01-23 00:07:17.867027543  [2023-01-23 00:07:17] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38310]
2023-01-23 00:07:17.893667046  [2023-01-23 00:07:17] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38312]
2023-01-23 00:07:18.142776656  [2023-01-23 00:07:18] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38312]
2023-01-23 00:07:18.175971273  [2023-01-23 00:07:18] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38326]
2023-01-23 00:07:18.403160917  [2023-01-23 00:07:18] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38326]
2023-01-23 00:07:18.428082209  [2023-01-23 00:07:18] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38338]
2023-01-23 00:07:18.667535894  [2023-01-23 00:07:18] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38338]
2023-01-23 00:07:18.695683057  [2023-01-23 00:07:18] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38342]
2023-01-23 00:07:18.903993399  [2023-01-23 00:07:18] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38342]
2023-01-23 00:07:18.933826331  [2023-01-23 00:07:18] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38350]
2023-01-23 00:07:19.151824223  [2023-01-23 00:07:19] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38350]
2023-01-23 00:07:19.201032941  [2023-01-23 00:07:19] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38358]
2023-01-23 00:07:19.363152381  [2023-01-23 00:07:19] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38358]
2023-01-23 00:07:19.387719360  [2023-01-23 00:07:19] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38362]
2023-01-23 00:07:19.590841945  [2023-01-23 00:07:19] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38362]
2023-01-23 00:07:19.627836631  [2023-01-23 00:07:19] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:38378]
2023-01-23 00:07:20.322920412  [2023-01-23 00:07:20] frigate.video                  ERROR   : TestCam1: Unable to read frames from ffmpeg process.
2023-01-23 00:07:20.322937170  [2023-01-23 00:07:20] frigate.video                  ERROR   : TestCam1: ffmpeg process is not running. exiting capture thread...

FFprobe output from your camera

"[\n  {\n    \"return_code\": 0,\n    \"stderr\": {},\n    \"stdout\": {\n      \"programs\": [],\n      \"streams\": [\n        {\n          \"avg_frame_rate\": \"0/0\",\n          \"codec_long_name\": \"H.265 / HEVC (High Efficiency Video Coding)\",\n          \"height\": 1800,\n          \"width\": 3200\n        },\n        {\n          \"avg_frame_rate\": \"0/0\",\n          \"codec_long_name\": \"AAC (Advanced Audio Coding)\"\n        }\n      ]\n    }\n  }\n]"

Frigate stats

{"TestCam1":{"camera_fps":0.0,"capture_pid":1264,"detection_enabled":0,"detection_fps":0.0,"ffmpeg_pid":1386,"pid":1262,"process_fps":0.0,"skipped_fps":0.0},"cpu_usages":{"%Cpu(s):":{"cpu":"id,","mem":"0.0"},"1":{"cpu":"0.0","mem":"0.0"},"110":{"cpu":"0.0","mem":"0.0"},"1148":{"cpu":"0.0","mem":"0.0"},"125":{"cpu":"0.0","mem":"0.0"},"1250":{"cpu":"0.0","mem":"0.2"},"1255":{"cpu":"0.0","mem":"0.0"},"1256":{"cpu":"0.0","mem":"0.3"},"1257":{"cpu":"0.3","mem":"0.3"},"126":{"cpu":"0.0","mem":"0.0"},"1262":{"cpu":"0.0","mem":"0.3"},"1263":{"cpu":"0.0","mem":"0.0"},"1264":{"cpu":"0.0","mem":"0.3"},"127":{"cpu":"0.0","mem":"0.0"},"128":{"cpu":"0.0","mem":"0.0"},"129":{"cpu":"0.0","mem":"0.0"},"1388":{"cpu":"6.7","mem":"0.0"},"139":{"cpu":"0.0","mem":"0.0"},"1400":{"cpu":"0.0","mem":"0.0"},"1401":{"cpu":"0.0","mem":"0.0"},"1403":{"cpu":"0.0","mem":"0.0"},"1407":{"cpu":"0.0","mem":"0.0"},"15":{"cpu":"0.0","mem":"0.0"},"157":{"cpu":"0.0","mem":"0.0"},"18":{"cpu":"0.0","mem":"0.0"},"186":{"cpu":"0.0","mem":"0.0"},"232":{"cpu":"0.0","mem":"0.0"},"24":{"cpu":"0.0","mem":"0.0"},"25":{"cpu":"0.0","mem":"0.0"},"26":{"cpu":"0.0","mem":"0.0"},"27":{"cpu":"0.0","mem":"0.0"},"271":{"cpu":"0.0","mem":"0.0"},"28":{"cpu":"0.0","mem":"0.0"},"29":{"cpu":"0.0","mem":"0.0"},"296":{"cpu":"0.0","mem":"0.0"},"30":{"cpu":"0.0","mem":"0.0"},"31":{"cpu":"0.0","mem":"0.0"},"313":{"cpu":"0.0","mem":"0.0"},"325":{"cpu":"0.0","mem":"0.0"},"346":{"cpu":"0.0","mem":"0.0"},"371":{"cpu":"0.0","mem":"0.0"},"40":{"cpu":"0.0","mem":"0.0"},"407":{"cpu":"0.0","mem":"0.0"},"41":{"cpu":"0.0","mem":"0.0"},"452":{"cpu":"0.0","mem":"0.0"},"505":{"cpu":"0.0","mem":"0.0"},"549":{"cpu":"0.0","mem":"0.0"},"585":{"cpu":"0.0","mem":"0.0"},"607":{"cpu":"0.0","mem":"0.0"},"625":{"cpu":"0.0","mem":"0.0"},"646":{"cpu":"0.0","mem":"0.0"},"685":{"cpu":"0.0","mem":"0.0"},"730":{"cpu":"0.0","mem":"0.0"},"77":{"cpu":"0.0","mem":"0.0"},"772":{"cpu":"0.0","mem":"0.0"},"78":{"cpu":"0.0","mem":"0.0"},"79":{"cpu":"0.0","mem":"0.0"},"820":{"cpu":"0.0","mem":"0.0"},"86":{"cpu":"0.0","mem":"0.0"},"867":{"cpu":"0.0","mem":"0.0"},"901":{"cpu":"0.0","mem":"0.0"},"929":{"cpu":"0.0","mem":"0.0"},"956":{"cpu":"0.0","mem":"0.0"},"99":{"cpu":"1.0","mem":"0.4"},"MiB":{"cpu":"25424.9","mem":"avail"},"PID":{"cpu":"%CPU","mem":"%MEM"},"Tasks:":{"cpu":"stopped,","mem":"0"},"top":{"cpu":"users,","mem":"load"}},"detection_fps":0.0,"detectors":{"cpu":{"detection_start":0.0,"inference_speed":10.0,"pid":1256}},"gpu_usages":{"NVIDIA GeForce RTX 4080":{"gpu":"3 %","mem":"2.1 %"}},"service":{"latest_version":"0.11.1","storage":{"/dev/shm":{"free":4294.6,"mount_type":"tmpfs","total":4295.0,"used":0.3},"/media/frigate/clips":{"free":947153.7,"mount_type":"zfs","total":947741.1,"used":587.5},"/media/frigate/recordings":{"free":947153.7,"mount_type":"zfs","total":947741.1,"used":587.5},"/tmp/cache":{"free":1000.0,"mount_type":"tmpfs","total":1000.0,"used":0.0}},"temperatures":{},"uptime":70,"version":"0.12.0-12d51d3"}}

Operating system

Other Linux

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Hikvision DS-2CD3367WDV3-L

Any other information that may be helpful

No response

LckySndays avatar Jan 22 '23 16:01 LckySndays

Does this happen when you use frigate ffmpeg with the camera directly?

NickM-27 avatar Jan 22 '23 16:01 NickM-27

cameras:
  TestCam1:
    ffmpeg:
      inputs:
        - path: rtsp://user:[email protected]/Streaming/Channels/101 --> OK
          roles:
            - restream
          hwaccel_args: preset-nvidia-h265
          input_args: preset-rtsp-restream

  TestCam2:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/TestCam1 --> ERROR
          roles:
            - restream
          hwaccel_args: preset-nvidia-h265
          input_args: preset-rtsp-restream

After testing it out, the error only occurred when restreaming it using go2rtc But I think only MSE and WebRTC are restream using go2rtc

LckySndays avatar Jan 22 '23 16:01 LckySndays

But I think only MSE and WebRTC are restream using go2rtc

Not sure what you mean, using 127.0.0.1:8554 uses the same restrema as the source.

At this point the recommendation would be to try not using ffmpeg: for the stream or using a manual exec:

Seems the default go2rtc ffmpeg args are not playing nice with the low shutter speed.

NickM-27 avatar Jan 22 '23 16:01 NickM-27

@NickM-27 Thanks for your recommendation, Just to be clear, when you're referring using a manual exec: Are you referring to this one? https://github.com/AlexxIT/go2rtc

Source: Exec
FFmpeg source just a shortcut to exec source. You can get any stream or file or device via FFmpeg or GStreamer and push it to go2rtc via RTSP protocol:

streams:
  stream1: exec:ffmpeg -hide_banner -re -stream_loop -1 -i /media/BigBuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {output}

LckySndays avatar Jan 22 '23 16:01 LckySndays

Correct, you could try looking at frigates args in /API/config and using those for exec. I'd first try using it without ffmpeg: and see how that fairs as well.

NickM-27 avatar Jan 22 '23 17:01 NickM-27

Thanks, /api/config is working for me but the uppercase one did not

LckySndays avatar Jan 22 '23 17:01 LckySndays

I'm on mobile so that would be autocorrects fault 🙃

NickM-27 avatar Jan 22 '23 17:01 NickM-27

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 22 '23 00:02 github-actions[bot]