blakeblackshear / frigate

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

[Config Support]: go2rtc ffmpeg device source issue #5484

Closed Valinwolf closed 1 year ago

Valinwolf commented 1 year ago

Describe the problem you are having

The problem seems to be very close to #5137, if not identical. I am running Frigate 0.12.0-b7 on a RPi4B, with ffmpeg version 4.3.5 installed from the Debian repos. I tried the configs in that issue with no dice. Any ideas?

Version

0.12.0-66881eb

Frigate config file

mqtt:
  host: 127.0.0.1
  port: 1884
  topic_prefix: frigate
  user: frigate
  password: Bo7sfaWcNGXsdKYc
  stats_interval: 60
birdseye:
  enabled: True
  width: 1920
  height: 1080
  quality: 1
  mode: continuous
  restream: true
go2rtc:
  logs:
    format: text
    exec: trace
  streams:
    entry:
      - ffmpeg:device?video=0&resolution=1920x1080#video=h264
  webrtc:
    candidates:
      - HOST_IP:8555
      - stun:8555
record:
  enabled: True
  retain:
    days: 14
    mode: all
  events:
    retain:
      default: 30
      mode: active_objects
snapshots:
  enabled: True
  height: 1440
  retain:
    default: 60
cameras:
  entry:
    record:
      enabled: false
    snapshots:
      enabled: false
    detect:
      enabled: false
    mqtt:
      enabled: false
    ui:
      order: 1
      dashboard: true
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/entry
          input_args: preset-rtsp-restream

Relevant log output

2023-02-13 18:26:58.102854008  18:26:58.102 INF go2rtc version 1.1.1 linux/arm64
2023-02-13 18:26:58.103988767  18:26:58.103 INF [api] listen addr=:1984
2023-02-13 18:26:58.105454502  18:26:58.105 INF [rtsp] listen addr=:8554
2023-02-13 18:26:58.106898737  18:26:58.106 INF [srtp] listen addr=:8443
2023-02-13 18:26:58.107912665  18:26:58.107 INF [webrtc] listen addr=:8555
2023-02-13 18:27:03.386546096  18:27:03.386 ERR github.com/AlexxIT/go2rtc/cmd/streams/producer.go:52 > error="exec: exit status 1" url=ffmpeg:device?video=0&resolution=1280x720#video=h264

Frigate stats

No response

Operating system

Debian

Install method

Docker CLI

Coral version

CPU (no coral)

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

I don't think they're related. In this case go2rtc is failing. You should enable trace logs for the exec module to get more info. Also you should show your docker CLI command.

Valinwolf commented 1 year ago

I don't think they're related. In this case go2rtc is failing. You should enable trace logs for the exec module to get more info.

I thought that's what this segment was supposed to do?

go2rtc:
  logs:
    format: text
    exec: trace

Also you should show your docker CLI command.

docker run -d   --name frigate   --restart=unless-stopped   --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 --shm-size=256m   -v /etc/localtime:/etc/localtime:ro -v /mnt/frigate/config:/config -v /mnt/frigate/storage:/media/frigate -v /etc/localtime:/etc/localtime:ro --device /dev/video0 -e FRIGATE_RTSP_PASSWORD='CENSORED' --network host ghcr.io/blakeblackshear/frigate:0.12.0-beta7
NickM-27 commented 1 year ago

You have a typo. The go2rtc section is just log not logs https://github.com/AlexxIT/go2rtc#module-log

Valinwolf commented 1 year ago

You have a typo. The go2rtc section is just log not logs https://github.com/AlexxIT/go2rtc#module-log

I was wondering why it wasn't giving me any extra info....

2023-02-13 18:38:21.810166495  18:38:21.809 INF go2rtc version 1.1.1 linux/arm64
2023-02-13 18:38:21.811112535  18:38:21.810 INF [api] listen addr=:1984
2023-02-13 18:38:21.812144445  18:38:21.811 INF [rtsp] listen addr=:8554
2023-02-13 18:38:21.813201761  18:38:21.813 INF [srtp] listen addr=:8443
2023-02-13 18:38:21.813986378  18:38:21.813 INF [webrtc] listen addr=:8555
2023-02-13 18:38:25.302246025  18:38:25.302 TRC [ffmpeg] fd
2023-02-13 18:38:25.302435429  18:38:25.302 TRC [ffmpeg] full
2023-02-13 18:38:25.302439874  18:38:25.302 TRC [ffmpeg] mqueue
2023-02-13 18:38:25.302452466  18:38:25.302 TRC [ffmpeg] null
2023-02-13 18:38:25.302748276  18:38:25.302 TRC [ffmpeg] ptmx
2023-02-13 18:38:25.302752628  18:38:25.302 TRC [ffmpeg] pts
2023-02-13 18:38:25.302965328  18:38:25.302 TRC [ffmpeg] random
2023-02-13 18:38:25.302969458  18:38:25.302 TRC [ffmpeg] shm
2023-02-13 18:38:25.303198750  18:38:25.302 TRC [ffmpeg] stderr
2023-02-13 18:38:25.303202528  18:38:25.303 TRC [ffmpeg] stdin
2023-02-13 18:38:25.303204528  18:38:25.303 TRC [ffmpeg] stdout
2023-02-13 18:38:25.303409432  18:38:25.303 TRC [ffmpeg] tty
2023-02-13 18:38:25.303592855  18:38:25.303 TRC [ffmpeg] urandom
2023-02-13 18:38:25.303596836  18:38:25.303 TRC [ffmpeg] video0
2023-02-13 18:38:25.753322335  18:38:25.753 TRC [ffmpeg] zero
2023-02-13 18:38:25.753763939  18:38:25.753 DBG [exec] run url="exec:ffmpeg -hide_banner -f v4l2 -video_size 1280x720 -i /dev/video0 -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -an -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://localhost:8554/a3f655ecd51e6f9a8e8a7a5fb80f7252"
2023-02-13 18:38:27.128983694  Input #0, video4linux2,v4l2, from '/dev/video0':
2023-02-13 18:38:27.128997009    Duration: N/A, start: 6671.001030, bitrate: 147456 kb/s
2023-02-13 18:38:27.129090840      Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
2023-02-13 18:38:27.130016714  Stream mapping:
2023-02-13 18:38:27.130025084    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
2023-02-13 18:38:27.130027084  Press [q] to stop, [?] for help
2023-02-13 18:38:27.138457317  x264 [error]: high profile doesn't support 4:2:2
2023-02-13 18:38:27.138469761  [libx264 @ 0x5593ce2ef0] Error setting profile high.
2023-02-13 18:38:27.138531279  [libx264 @ 0x5593ce2ef0] Possible profiles: baseline main high high10 high422 high444
2023-02-13 18:38:27.138536538  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2023-02-13 18:38:27.160403089  Conversion failed!
2023-02-13 18:38:27.170778864  18:38:27.170 ERR github.com/AlexxIT/go2rtc/cmd/streams/producer.go:52 > error="exec: exit status 1" url=ffmpeg:device?video=0&resolution=1280x720#video=h264
2023-02-13 18:38:27.171111025  18:38:27.170 DBG [exec] run url="exec:ffmpeg -hide_banner -f v4l2 -video_size 1280x720 -i /dev/video0 -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -an -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://localhost:8554/a3f655ecd51e6f9a8e8a7a5fb80f7252"
2023-02-13 18:38:28.541984814  Input #0, video4linux2,v4l2, from '/dev/video0':
2023-02-13 18:38:28.541997665    Duration: N/A, start: 6672.418094, bitrate: 147456 kb/s
2023-02-13 18:38:28.542230087      Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
2023-02-13 18:38:28.543083425  Stream mapping:
2023-02-13 18:38:28.543092666    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
2023-02-13 18:38:28.543326532  Press [q] to stop, [?] for help
2023-02-13 18:38:28.551336976  x264 [error]: high profile doesn't support 4:2:2
2023-02-13 18:38:28.551349216  [libx264 @ 0x558a332ef0] Error setting profile high.
2023-02-13 18:38:28.551406475  [libx264 @ 0x558a332ef0] Possible profiles: baseline main high high10 high422 high444
2023-02-13 18:38:28.551560120  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2023-02-13 18:38:28.573295507  Conversion failed!
2023-02-13 18:38:28.583509229  18:38:28.583 ERR github.com/AlexxIT/go2rtc/cmd/streams/producer.go:52 > error="exec: exit status 1" url=ffmpeg:device?video=0&resolution=1280x720#video=h264
2023-02-13 18:38:28.583585098  18:38:28.583 WRN [rtsp] error="source 0 error: exec: exit status 1" stream=entry
2023-02-13 18:38:45.152912002  18:38:45.152 DBG [exec] run url="exec:ffmpeg -hide_banner -f v4l2 -video_size 1280x720 -i /dev/video0 -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -an -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://localhost:8554/a3f655ecd51e6f9a8e8a7a5fb80f7252"
2023-02-13 18:38:46.770423885  Input #0, video4linux2,v4l2, from '/dev/video0':
2023-02-13 18:38:46.770778990    Duration: N/A, start: 6690.642531, bitrate: 147456 kb/s
2023-02-13 18:38:46.771229761      Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
2023-02-13 18:38:46.772075802  Stream mapping:
2023-02-13 18:38:46.772260151    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
2023-02-13 18:38:46.772327687  Press [q] to stop, [?] for help
2023-02-13 18:38:46.780536979  x264 [error]: high profile doesn't support 4:2:2
2023-02-13 18:38:46.780698902  [libx264 @ 0x559141bef0] Error setting profile high.
2023-02-13 18:38:46.781100914  [libx264 @ 0x559141bef0] Possible profiles: baseline main high high10 high422 high444
2023-02-13 18:38:46.781200598  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2023-02-13 18:38:46.803567844  Conversion failed!
2023-02-13 18:38:46.813737178  18:38:46.813 ERR github.com/AlexxIT/go2rtc/cmd/streams/producer.go:52 > error="exec: exit status 1" url=ffmpeg:device?video=0&resolution=1280x720#video=h264
2023-02-13 18:38:46.814165912  18:38:46.813 DBG [exec] run url="exec:ffmpeg -hide_banner -f v4l2 -video_size 1280x720 -i /dev/video0 -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -an -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://localhost:8554/a3f655ecd51e6f9a8e8a7a5fb80f7252"
2023-02-13 18:38:48.185105892  Input #0, video4linux2,v4l2, from '/dev/video0':
2023-02-13 18:38:48.185118447    Duration: N/A, start: 6692.061216, bitrate: 147456 kb/s
2023-02-13 18:38:48.185197501      Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
2023-02-13 18:38:48.186076135  Stream mapping:
2023-02-13 18:38:48.186085394    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
2023-02-13 18:38:48.186128023  Press [q] to stop, [?] for help
2023-02-13 18:38:48.194199965  x264 [error]: high profile doesn't support 4:2:2
2023-02-13 18:38:48.194213169  [libx264 @ 0x55867e3ef0] Error setting profile high.
2023-02-13 18:38:48.194274279  [libx264 @ 0x55867e3ef0] Possible profiles: baseline main high high10 high422 high444
2023-02-13 18:38:48.194279594  Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2023-02-13 18:38:48.215983499  Conversion failed!
2023-02-13 18:38:48.225972021  18:38:48.225 ERR github.com/AlexxIT/go2rtc/cmd/streams/producer.go:52 > error="exec: exit status 1" url=ffmpeg:device?video=0&resolution=1280x720#video=h264
2023-02-13 18:38:48.226048390  18:38:48.225 WRN [rtsp] error="source 0 error: exec: exit status 1" stream=entry
NickM-27 commented 1 year ago

you should make an issue on go2rtc with this information

Valinwolf commented 1 year ago

Will do! I'll update this comment with the issue link.

Valinwolf commented 1 year ago

Issue created: AlexxIT/go2rtc#256

Closing this one.

Valinwolf commented 1 year ago

I'm not so sure it isn't the same issue now, the initial issue was I was using the wrong resolution and it was causing go2rtc to error out. Now I'm having a timeout issue. Something about timeout/stimeout was mentioned in #5137. I'm not super video savvy, so I'm not sure. I'm attempting the config options posted in that comment now.

NickM-27 commented 1 year ago

This issue has to do with rtsp timeout / stimeout. You are not using rtsp for this so it is absolutely unrelated

Valinwolf commented 1 year ago

This issue has to do with rtsp timeout / stimeout. You are not using rtsp for this so it is absolutely unrelated

Ah. Like I said, I am completely not video savvy. I don't understand 3/4 of FFmpeg lol