blakeblackshear / frigate

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

[Config Support]: Cannot get Nvidia Hardware accel to work with recording stream #8503

Closed midget214 closed 8 months ago

midget214 commented 8 months ago

Describe the problem you are having

I've been struggling to get my reolink duo 2's main stream to record as h.264 using my GPU to re-encode the stream. I've lost count on the amount of reddit posts and github config support threads I've read to try and fix this issue. My config below is working (ffprobe shows the main stream as h.264 20 FPS) and the recorded clips are playing in firefox, but my CPU usage has spiked as a result. The moment I add #hardware to the stream I get a bunch of EOF errors and the notorious green screen appears in the recordings.

I'm at my wits end. Any help would be appreciated.

Version

0.12.1-367d724

Frigate config file

detectors:
  coral:
    type: edgetpu
    device: usb

objects:
  track:
    - person
    - car
    - cat
    - dog

motion:
  mask:    
    - 223,24,410,23,409,0,223,0

ffmpeg:
  hwaccel_args: preset-nvidia-h264

go2rtc:
  streams:
    garage_front:
      #  This currently works - but with high CPU usage
      - "ffmpeg:rtsp://viewer:###@192.168.13.3:554/h265Preview_01_main#video=h264#audio=aac#audio=opus"

      #  This breaks
#      - "ffmpeg:rtsp://viewer:###@192.168.13.3:554/h265Preview_01_main#video=h264#hardware"

      #  This doesn't seem to do any encoding - clips are still stored as h.265 (probe also still shows h.265)
#      - rtsp://###@192.168.13.3:554/h265Preview_01_main
#      - "ffmpeg:garage_front#video=h264#hardware"
    garage_front_sub:
      - rtsp://viewer:###@192.168.13.3:554/h264Preview_01_sub
      - ffmpeg:garage_front_sub#audio=aac#audio=opus

  webrtc:
    candidates:
      - 192.168.12.2:8555
      - stun:8555

cameras:
  garage_front:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/garage_front_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/garage_front
          roles:
            - record
    live:
      stream_name: garage_front_sub
    detect:                 
      width: 1536
      height: 576
      fps: 5
    snapshots:
       enabled: true
    record:
      enabled: true
      retain: 
        days: 1
      events:
        retain:
          default: 2 
          mode: motion 
        pre_capture: 3 
        post_capture: 10

Relevant log output

2023-11-06 20:47:05.689244519  20:47:05.688 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware#audio=aac#audio=opus

Frigate stats

No response

Operating system

Other

Install method

Docker Compose

Coral version

USB

Any other information that may be helpful

No response

NickM-27 commented 8 months ago

if you have nvidia then I'd suggest specifying #hardware=cuda and show the logs for that if it fails

midget214 commented 8 months ago

Unfortunately it seems like its the same errors.

Config update

FFProbe output

Ffprobe Output
Stream 0:
Return Code: 0

Video:

Codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
Resolution: 1536x576
FPS: 15/1

Audio:

Codec: AAC (Advanced Audio Coding)

Stream 1:
Return Code: 0

Video:

Codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
Resolution: 4096x1536
FPS: Unknown

Audio:

Codec: AAC (Advanced Audio Coding)

Errors

2023-11-06 21:13:51.656756134  21:13:51.656 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:13:54.635803064  21:13:54.635 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:13:57.566179141  [INFO] Starting go2rtc healthcheck service
2023-11-06 21:13:57.652770632  21:13:57.652 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:14:00.645012338  21:14:00.644 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:14:03.649378096  21:14:03.649 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:14:06.649987434  21:14:06.649 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:14:09.648113299  21:14:09.648 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:***@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
NickM-27 commented 8 months ago

I would suggest enabling trace logs for exec

go2rtc:
  log:
    exec: trace
  streams: ...

also, getting the info from the go2rtc dashboard while using this stream will provide some helpful information

midget214 commented 8 months ago

More log details added

2023-11-06 21:20:18.568724390  21:20:18.568 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 21:20:20.615930451  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 21:20:20.615933727    Metadata:
2023-11-06 21:20:20.615934829      title           : Session streamed by "preview"
2023-11-06 21:20:20.615938777      comment         : h265Preview_01_main
2023-11-06 21:20:20.615939578    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 21:20:20.615951311    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 21:20:20.615999272    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 21:20:20.697249264  Stream mapping:
2023-11-06 21:20:20.697252761    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 21:20:20.697253923    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 21:20:20.697254845    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 21:20:20.697265666  Press [q] to stop, [?] for help
2023-11-06 21:20:20.698003837  [libopus @ 0x55f2a7f65f80] No bit rate set. Defaulting to 64000 bps.
2023-11-06 21:20:20.717366450  [hevc @ 0x55f2a7f67fc0] Could not find ref with POC 1
2023-11-06 21:20:20.747362285  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 21:20:20.747366093  21:20:20.747 DBG [exec] run launch=2.17862411s
2023-11-06 21:20:20.747395919    Metadata:
2023-11-06 21:20:20.747449210      title           : Session streamed by "preview"
2023-11-06 21:20:20.747537308      comment         : h265Preview_01_main
2023-11-06 21:20:20.747606659      encoder         : Lavf59.27.100
2023-11-06 21:20:20.747745463    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 21:20:20.747787623      Metadata:
2023-11-06 21:20:20.747854179        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 21:20:20.747903433      Side data:
2023-11-06 21:20:20.747948208        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 21:20:20.747974618    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 21:20:20.747976361      Metadata:
2023-11-06 21:20:20.747977293        encoder         : Lavc59.37.100 aac
2023-11-06 21:20:20.747978195    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 21:20:20.747978886      Metadata:
2023-11-06 21:20:20.748176621        encoder         : Lavc59.37.100 libopus
2023-11-06 21:20:21.603942732  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.14 bitrate=N/A dup=22 drop=0 speed=1.12e+03x    
frame=   34 fps=0.0 q=29.0 size=N/A time=00:00:01.72 bitrate=N/A dup=22 drop=0 speed=3.33x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 21:20:21.604161387  Error reinitializing filters!
2023-11-06 21:20:21.604163501  Failed to inject frame into filter network: Function not implemented
2023-11-06 21:20:21.604164573  Error while processing the decoded data for stream #0:0
2023-11-06 21:20:21.639039730  [aac @ 0x55f2a7f668c0] Qavg: 65254.957
2023-11-06 21:20:21.639044248  [aac @ 0x55f2a7f668c0] 2 frames left in the queue on closing
2023-11-06 21:20:21.639064166  [libopus @ 0x55f2a7f65f80] 1 frames left in the queue on closing
2023-11-06 21:20:21.688422915  Conversion failed!
2023-11-06 21:20:21.694696183  21:20:21.694 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:20:21.694700100  21:20:21.694 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 21:20:21.719224650  21:20:21.719 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 21:20:23.619948440  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 21:20:23.619952067    Metadata:
2023-11-06 21:20:23.619953159      title           : Session streamed by "preview"
2023-11-06 21:20:23.619953970      comment         : h265Preview_01_main
2023-11-06 21:20:23.619965222    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 21:20:23.619968999    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 21:20:23.619982805    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 21:20:23.692573932  Stream mapping:
2023-11-06 21:20:23.692578461    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 21:20:23.692579893    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 21:20:23.692581035    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 21:20:23.692582117  Press [q] to stop, [?] for help
2023-11-06 21:20:23.693332923  [libopus @ 0x55ed66871f80] No bit rate set. Defaulting to 64000 bps.
2023-11-06 21:20:23.713272951  [hevc @ 0x55ed668d2b80] Could not find ref with POC 1
2023-11-06 21:20:23.743849749  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 21:20:23.743852595    Metadata:
2023-11-06 21:20:23.743853667      title           : Session streamed by "preview"
2023-11-06 21:20:23.743854488  21:20:23.743 DBG [exec] run launch=2.049162023s
2023-11-06 21:20:23.743855340      comment         : h265Preview_01_main
2023-11-06 21:20:23.743856122      encoder         : Lavf59.27.100
2023-11-06 21:20:23.743865419    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 21:20:23.743866211      Metadata:
2023-11-06 21:20:23.743867012        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 21:20:23.743867754      Side data:
2023-11-06 21:20:23.743868605        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 21:20:23.743889335    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 21:20:23.743891038      Metadata:
2023-11-06 21:20:23.743896318        encoder         : Lavc59.37.100 aac
2023-11-06 21:20:23.743907709    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 21:20:23.743908461      Metadata:
2023-11-06 21:20:23.743909202        encoder         : Lavc59.37.100 libopus
2023-11-06 21:20:24.606488906  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.14 bitrate=N/A dup=22 drop=0 speed=1.06e+03x    
frame=   34 fps=0.0 q=29.0 size=N/A time=00:00:01.72 bitrate=N/A dup=22 drop=0 speed=3.25x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 21:20:24.606646675  Error reinitializing filters!
2023-11-06 21:20:24.606648689  Failed to inject frame into filter network: Function not implemented
2023-11-06 21:20:24.606655833  Error while processing the decoded data for stream #0:0
2023-11-06 21:20:24.636748352  [aac @ 0x55ed66873200] Qavg: 65252.242
2023-11-06 21:20:24.636752159  [aac @ 0x55ed66873200] 2 frames left in the queue on closing
2023-11-06 21:20:24.636763621  [libopus @ 0x55ed66871f80] 1 frames left in the queue on closing
2023-11-06 21:20:24.650054759  Conversion failed!
2023-11-06 21:20:24.655778423  21:20:24.655 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main#video=h264#hardware=cuda#audio=aac#audio=opus
2023-11-06 21:20:24.655925422  21:20:24.655 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 21:20:24.677395405  21:20:24.677 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 21:20:26.615517271  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 21:20:26.615521519    Metadata:
2023-11-06 21:20:26.615522671      title           : Session streamed by "preview"
2023-11-06 21:20:26.615523513      comment         : h265Preview_01_main
2023-11-06 21:20:26.615690931    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 21:20:26.615693616    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 21:20:26.615694758    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 21:20:26.693399651  Stream mapping:
2023-11-06 21:20:26.693403378    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 21:20:26.693404440    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 21:20:26.693405312    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 21:20:26.693406103  Press [q] to stop, [?] for help
2023-11-06 21:20:26.694266136  [libopus @ 0x55f2e9406dc0] No bit rate set. Defaulting to 64000 bps.
2023-11-06 21:20:26.715058472  [hevc @ 0x55f2e93c3fc0] Could not find ref with POC 1
2023-11-06 21:20:26.745892168  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 21:20:26.745895825  21:20:26.745 DBG [exec] run launch=2.089935046s
2023-11-06 21:20:26.745930231    Metadata:
2023-11-06 21:20:26.745986848      title           : Session streamed by "preview"
2023-11-06 21:20:26.746038927      comment         : h265Preview_01_main
2023-11-06 21:20:26.746091116      encoder         : Lavf59.27.100
2023-11-06 21:20:26.746139298    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 21:20:26.746207527      Metadata:
2023-11-06 21:20:26.746209421        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 21:20:26.746210312      Side data:
2023-11-06 21:20:26.746211224        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 21:20:26.746212156    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 21:20:26.746212877      Metadata:
2023-11-06 21:20:26.746213659        encoder         : Lavc59.37.100 aac
2023-11-06 21:20:26.746214510    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 21:20:26.746215232      Metadata:
2023-11-06 21:20:26.746215983        encoder         : Lavc59.37.100 libopus
2023-11-06 21:20:27.607757595  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.14 bitrate=N/A dup=22 drop=0 speed= 992x    
frame=   34 fps=0.0 q=29.0 size=N/A time=00:00:01.72 bitrate=N/A dup=22 drop=0 speed=3.33x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 21:20:27.607964408  Error reinitializing filters!
2023-11-06 21:20:27.607990878  Failed to inject frame into filter network: Function not implemented
2023-11-06 21:20:27.608017489  Error while processing the decoded data for stream #0:0
2023-11-06 21:20:27.636970445  [aac @ 0x55f2e9441900] Qavg: 65218.023
2023-11-06 21:20:27.636973832  [aac @ 0x55f2e9441900] 2 frames left in the queue on closing
2023-11-06 21:20:27.637030379  [libopus @ 0x55f2e9406dc0] 1 frames left in the queue on closing
2023-11-06 21:20:27.650606027  Conversion failed!
midget214 commented 8 months ago
{
  "producers": [
    {
      "type": "RTSP passive producer",
      "url": "rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703",
      "remote_addr": "127.0.0.1:35290",
      "user_agent": "ffmpeg/go2rtc",
      "sdp": "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=Session streamed by \"preview\"\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\na=tool:libavformat LIBAVFORMAT_VERSION\r\nm=video 0 RTP/AVP 96\r\nb=AS:2000\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAM6wrQAgAGDYCIAAAfQAAE4gcAAADAtxsAAD0JBd5cFA=,aO48sA==; profile-level-id=640033\r\na=control:streamid=0\r\nm=audio 0 RTP/AVP 97\r\nb=AS:69\r\na=rtpmap:97 MPEG4-GENERIC/16000/1\r\na=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=140856E500\r\na=control:streamid=1\r\nm=audio 0 RTP/AVP 98\r\nb=AS:64\r\na=rtpmap:98 opus/48000/2\r\na=control:streamid=2\r\n",
      "medias": [
        "video, recvonly, H.264 High 5.1",
        "audio, recvonly, MPEG4-GENERIC/16000",
        "audio, recvonly, OPUS/48000/2"
      ],
      "receivers": [
        "96 H264, bytes=9775, senders=1",
        "97 MPEG4-GENERIC/16000, bytes=4585, senders=1",
        "98 OPUS/48000/2, bytes=5213, senders=0"
      ],
      "recv": 20629
    }
  ],
  "consumers": [
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/garage_front",
      "remote_addr": "127.0.0.1:35026",
      "user_agent": "FFmpeg Frigate/0.12.1-367d724",
      "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.7.1\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAM6wrQAgAGDYCIAAAfQAAE4gcAAADAtxsAAD0JBd5cFA=,aO48sA==; profile-level-id=640033\r\na=control:trackID=0\r\nm=audio 0 RTP/AVP 97\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=140856E500\r\na=control:trackID=1\r\n",
      "medias": [
        "video, sendonly, H264, H265",
        "audio, sendonly, MPEG4-GENERIC"
      ],
      "senders": [
        "96 H264, bytes=1298409, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=556115, receivers=1"
      ],
      "send": 1940252
    }
  ]
}`
NickM-27 commented 8 months ago

I see the issue, I'd suggest updating go2rtc https://docs.frigate.video/configuration/advanced#custom-go2rtc-version

midget214 commented 8 months ago

I see the issue, I'd suggest updating go2rtc https://docs.frigate.video/configuration/advanced#custom-go2rtc-version

Thanks for the help with the formatting the log. Updating go2rtc from 1.7.1 to 1.8.2 resolved the issue. I can see the GPU being used now and the CPU usage is down. Thanks so much.

midget214 commented 8 months ago

Eh... I closed this issue too soon. This is with the newest go2rtc binary

2023-11-06 22:09:20.709112065  22:09:20.709 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:22.638361545  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 22:09:22.638365623    Metadata:
2023-11-06 22:09:22.638367246      title           : Session streamed by "preview"
2023-11-06 22:09:22.638368448      comment         : h265Preview_01_main
2023-11-06 22:09:22.638369561    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 22:09:22.638384018    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 22:09:22.638389048    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 22:09:22.716767589  Stream mapping:
2023-11-06 22:09:22.716771357    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 22:09:22.716772439    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 22:09:22.716773310    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 22:09:22.716784532  Press [q] to stop, [?] for help
2023-11-06 22:09:22.717514848  [libopus @ 0x55c687fbe180] No bit rate set. Defaulting to 64000 bps.
2023-11-06 22:09:22.736969014  [hevc @ 0x55c687fbdd00] Could not find ref with POC 1
2023-11-06 22:09:22.768088793  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 22:09:22.768103160  22:09:22.768 DBG [exec] run launch=2.080741801s
2023-11-06 22:09:22.768128919    Metadata:
2023-11-06 22:09:22.768131163      title           : Session streamed by "preview"
2023-11-06 22:09:22.768138137      comment         : h265Preview_01_main
2023-11-06 22:09:22.768138988      encoder         : Lavf59.27.100
2023-11-06 22:09:22.768163365    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 22:09:22.768206256      Metadata:
2023-11-06 22:09:22.768208029        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 22:09:22.768208871      Side data:
2023-11-06 22:09:22.768209753        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 22:09:22.768210624    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 22:09:22.768211356      Metadata:
2023-11-06 22:09:22.768212117        encoder         : Lavc59.37.100 aac
2023-11-06 22:09:22.768212939    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 22:09:22.768213660      Metadata:
2023-11-06 22:09:22.768214401        encoder         : Lavc59.37.100 libopus
2023-11-06 22:09:23.632582272  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.14 bitrate=N/A dup=22 drop=0 speed=1.13e+03x    
frame=   34 fps=0.0 q=29.0 size=N/A time=00:00:01.78 bitrate=N/A dup=22 drop=0 speed=3.36x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 22:09:23.632771822  Error reinitializing filters!
2023-11-06 22:09:23.632773846  Failed to inject frame into filter network: Function not implemented
2023-11-06 22:09:23.632774948  Error while processing the decoded data for stream #0:0
2023-11-06 22:09:23.660826213  [aac @ 0x55c687fc3000] Qavg: 40055.605
2023-11-06 22:09:23.660828608  [aac @ 0x55c687fc3000] 2 frames left in the queue on closing
2023-11-06 22:09:23.661020051  [libopus @ 0x55c687fbe180] 1 frames left in the queue on closing
2023-11-06 22:09:23.673859722  Conversion failed!
2023-11-06 22:09:23.679947607  22:09:23.679 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main#video=h264#audio=aac#audio=opus#hardware=cuda
2023-11-06 22:09:23.680059600  22:09:23.679 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:23.701311128  22:09:23.701 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:24.163356734  [INFO] Starting go2rtc healthcheck service...
2023-11-06 22:09:25.651300996  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 22:09:25.651304122    Metadata:
2023-11-06 22:09:25.651305324      title           : Session streamed by "preview"
2023-11-06 22:09:25.651306216      comment         : h265Preview_01_main
2023-11-06 22:09:25.651492309    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 22:09:25.651494283    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 22:09:25.651495215    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 22:09:25.729471523  Stream mapping:
2023-11-06 22:09:25.729475370    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 22:09:25.729476492    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 22:09:25.729477464    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 22:09:25.729478286  Press [q] to stop, [?] for help
2023-11-06 22:09:25.748603628  [hevc @ 0x56101b450fc0] Could not find ref with POC 1
2023-11-06 22:09:25.914156697  [libopus @ 0x56101b4a94c0] No bit rate set. Defaulting to 64000 bps.
2023-11-06 22:09:25.915014616  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 22:09:25.915027991  22:09:25.914 DBG [exec] run launch=2.234979622s
2023-11-06 22:09:25.915045935    Metadata:
2023-11-06 22:09:25.915098605      title           : Session streamed by "preview"
2023-11-06 22:09:25.915146436      comment         : h265Preview_01_main
2023-11-06 22:09:25.915197713      encoder         : Lavf59.27.100
2023-11-06 22:09:25.915307962    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 22:09:25.915309926      Metadata:
2023-11-06 22:09:25.915310898        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 22:09:25.915390659      Side data:
2023-11-06 22:09:25.915392553        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 22:09:25.915393475    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 22:09:25.915394206      Metadata:
2023-11-06 22:09:25.915394987        encoder         : Lavc59.37.100 aac
2023-11-06 22:09:25.915395789    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 22:09:25.915396520      Metadata:
2023-11-06 22:09:25.915397292        encoder         : Lavc59.37.100 libopus
2023-11-06 22:09:26.629411153  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.20 bitrate=N/A dup=22 drop=0 speed=6.58x    
frame=   38 fps=0.0 q=29.0 size=N/A time=00:00:01.90 bitrate=N/A dup=22 drop=0 speed=2.78x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 22:09:26.629478541  Error reinitializing filters!
2023-11-06 22:09:26.629480475  Failed to inject frame into filter network: Function not implemented
2023-11-06 22:09:26.629481497  Error while processing the decoded data for stream #0:0
2023-11-06 22:09:26.657791693  [aac @ 0x56101b453dc0] Qavg: 37906.043
2023-11-06 22:09:26.657794599  [aac @ 0x56101b453dc0] 2 frames left in the queue on closing
2023-11-06 22:09:26.657951807  [libopus @ 0x56101b4a94c0] 1 frames left in the queue on closing
2023-11-06 22:09:26.670890897  Conversion failed!
2023-11-06 22:09:26.677047933  22:09:26.676 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main#video=h264#audio=aac#audio=opus#hardware=cuda
2023-11-06 22:09:26.677051480  22:09:26.677 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:26.698880063  22:09:26.698 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:28.650199916  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 22:09:28.650203082    Metadata:
2023-11-06 22:09:28.650204245      title           : Session streamed by "preview"
2023-11-06 22:09:28.650205166      comment         : h265Preview_01_main
2023-11-06 22:09:28.650205988    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 22:09:28.650218261    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 22:09:28.650229402    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 22:09:28.720208190  Stream mapping:
2023-11-06 22:09:28.720211927    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 22:09:28.720212949    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 22:09:28.720213821    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 22:09:28.720214592  Press [q] to stop, [?] for help
2023-11-06 22:09:28.740034884  [hevc @ 0x5579c1164fc0] Could not find ref with POC 1
2023-11-06 22:09:28.905538048  [libopus @ 0x5579c1160cc0] No bit rate set. Defaulting to 64000 bps.
2023-11-06 22:09:28.906379034  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 22:09:28.906382842  22:09:28.906 DBG [exec] run launch=2.229301235s
2023-11-06 22:09:28.906451913    Metadata:
2023-11-06 22:09:28.906543036      title           : Session streamed by "preview"
2023-11-06 22:09:28.906545140      comment         : h265Preview_01_main
2023-11-06 22:09:28.906616014      encoder         : Lavf59.27.100
2023-11-06 22:09:28.906618018    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 22:09:28.906618840      Metadata:
2023-11-06 22:09:28.906619671        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 22:09:28.906620423      Side data:
2023-11-06 22:09:28.906621324        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 22:09:28.906648095    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 22:09:28.906649858      Metadata:
2023-11-06 22:09:28.906650760        encoder         : Lavc59.37.100 aac
2023-11-06 22:09:28.906651632    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 22:09:28.906652343      Metadata:
2023-11-06 22:09:28.906751161        encoder         : Lavc59.37.100 libopus
2023-11-06 22:09:29.635760185  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.20 bitrate=N/A dup=22 drop=0 speed=6.56x    
frame=   37 fps=0.0 q=29.0 size=N/A time=00:00:01.90 bitrate=N/A dup=22 drop=0 speed=2.79x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 22:09:29.635818606  Error reinitializing filters!
2023-11-06 22:09:29.635819758  Failed to inject frame into filter network: Function not implemented
2023-11-06 22:09:29.635860285  Error while processing the decoded data for stream #0:0
2023-11-06 22:09:29.664213282  [aac @ 0x5579c1161740] Qavg: 33501.230
2023-11-06 22:09:29.664216809  [aac @ 0x5579c1161740] 2 frames left in the queue on closing
2023-11-06 22:09:29.664263628  [libopus @ 0x5579c1160cc0] 1 frames left in the queue on closing
2023-11-06 22:09:29.677531301  Conversion failed!
2023-11-06 22:09:29.683572227  22:09:29.683 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main#video=h264#audio=aac#audio=opus#hardware=cuda
2023-11-06 22:09:29.683655045  22:09:29.683 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:29.705318314  22:09:29.705 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:31.640106628  Input #0, rtsp, from 'rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main':
2023-11-06 22:09:31.640109805    Metadata:
2023-11-06 22:09:31.640110867      title           : Session streamed by "preview"
2023-11-06 22:09:31.640111698      comment         : h265Preview_01_main
2023-11-06 22:09:31.640122759    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 22:09:31.640126887    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 22:09:31.640141755    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 22:09:31.712695791  Stream mapping:
2023-11-06 22:09:31.712699398    Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
2023-11-06 22:09:31.712700490    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 22:09:31.712701402    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 22:09:31.712702203  Press [q] to stop, [?] for help
2023-11-06 22:09:31.713470852  [libopus @ 0x5641784cd480] No bit rate set. Defaulting to 64000 bps.
2023-11-06 22:09:31.733369643  [hevc @ 0x5641784cb680] Could not find ref with POC 1
2023-11-06 22:09:31.764307145  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/e8be7ae08ab8756afbf8893e1bfa3703':
2023-11-06 22:09:31.764322164  22:09:31.764 DBG [exec] run launch=2.080639086s
2023-11-06 22:09:31.764344496    Metadata:
2023-11-06 22:09:31.764346720      title           : Session streamed by "preview"
2023-11-06 22:09:31.764347732      comment         : h265Preview_01_main
2023-11-06 22:09:31.764389522      encoder         : Lavf59.27.100
2023-11-06 22:09:31.764391455    Stream #0:0: Video: h264 (High), cuda(tv, progressive), 4096x1536, q=2-31, 2000 kb/s, 20 fps, 90k tbn
2023-11-06 22:09:31.764392297      Metadata:
2023-11-06 22:09:31.764393149        encoder         : Lavc59.37.100 h264_nvenc
2023-11-06 22:09:31.764393900      Side data:
2023-11-06 22:09:31.764394772        cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
2023-11-06 22:09:31.764418487    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 22:09:31.764420190      Metadata:
2023-11-06 22:09:31.764421051        encoder         : Lavc59.37.100 aac
2023-11-06 22:09:31.764421913    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 22:09:31.764422594      Metadata:
2023-11-06 22:09:31.764423366        encoder         : Lavc59.37.100 libopus
2023-11-06 22:09:32.633665279  frame=   23 fps=0.0 q=31.0 size=N/A time=00:00:01.14 bitrate=N/A dup=22 drop=0 speed=1.09e+03x    
frame=   34 fps=0.0 q=29.0 size=N/A time=00:00:01.72 bitrate=N/A dup=22 drop=0 speed=3.23x    
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 22:09:32.633827256  Error reinitializing filters!
2023-11-06 22:09:32.633829170  Failed to inject frame into filter network: Function not implemented
2023-11-06 22:09:32.633830212  Error while processing the decoded data for stream #0:0
2023-11-06 22:09:32.662684721  [aac @ 0x5641784cc480] Qavg: 37305.840
2023-11-06 22:09:32.662687907  [aac @ 0x5641784cc480] 2 frames left in the queue on closing
2023-11-06 22:09:32.662751899  [libopus @ 0x5641784cd480] 1 frames left in the queue on closing
2023-11-06 22:09:32.675664368  Conversion failed!
2023-11-06 22:09:32.681675077  22:09:32.681 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=ffmpeg:rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main#video=h264#audio=aac#audio=opus#hardware=cuda
2023-11-06 22:09:32.681733738  22:09:32.681 DBG [exec] run url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:09:32.703042004  22:09:32.702 TRC [exec] close url="exec:ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main -map 0:v:0? -c:v:0 h264_nvenc -g 50 -bf 0 -profile:v:0 high -level:v:0 auto -preset:v:0 p2 -tune:v:0 ll -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
NickM-27 commented 8 months ago

There's a lot going on here, let's separate this out

go2rtc:
  streams:
    garage_front:
      - rtsp://viewer:###@192.168.13.3:554/h265Preview_01_main
      - "ffmpeg:garage_front#video=h264

    garage_front_sub:
      - rtsp://viewer:###@192.168.13.3:554/h264Preview_01_sub
      - ffmpeg:garage_front_sub#audio=aac#audio=opus

then you'll just need to add ?video=h264&audio to the stream in the frigate cameras section for record

midget214 commented 8 months ago

I've update the config and its seems to be encoding - its just not using the GPU atm

go2rtc:
  log:
    exec: trace
  streams:
    garage_front:
      - rtsp://viewer:xxx@192.168.13.3:554/h265Preview_01_main
      - ffmpeg:garage_front#video=h264#audio=aac#audio=opus

and the record section to

cameras:
  garage_front:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/garage_front?video=h264&audio=aac&hardware=cuda
          roles:
            - record

The logs show the following

2023-11-06 22:42:47.229230825  [INFO] Starting go2rtc...
2023-11-06 22:42:47.331313571  22:42:47.331 INF go2rtc version 1.8.2 linux/amd64
2023-11-06 22:42:47.331499995  22:42:47.331 INF [api] listen addr=:1984
2023-11-06 22:42:47.331715614  22:42:47.331 INF [rtsp] listen addr=:8554
2023-11-06 22:42:47.331845481  22:42:47.331 INF [webrtc] listen addr=:8555
2023-11-06 22:42:48.086324618  22:42:48.086 DBG [exec] run url="exec:ffmpeg -hide_banner -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://127.0.0.1:8554/garage_front?video&audio -map 0:v:0? -c:v:0 libx264 -g 50 -profile:v:0 high -level:v:0 4.1 -preset:v:0 superfast -tune:v:0 zerolatency -pix_fmt:v:0 yuv420p -map 0:a:0? -c:a:0 aac -map 0:a:0? -c:a:1 libopus -application:a:1 lowdelay -frame_duration 20 -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2023-11-06 22:42:50.048113271  Input #0, rtsp, from 'rtsp://127.0.0.1:8554/garage_front?video&audio':
2023-11-06 22:42:50.048119152    Metadata:
2023-11-06 22:42:50.048120174      title           : go2rtc/1.8.2
2023-11-06 22:42:50.048121065    Duration: N/A, start: 0.000000, bitrate: N/A
2023-11-06 22:42:50.048132267    Stream #0:0: Video: hevc (Main), yuv420p(tv), 4096x1536, 20 fps, 20 tbr, 90k tbn
2023-11-06 22:42:50.048145502    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-11-06 22:42:50.048977271  Stream mapping:
2023-11-06 22:42:50.048979255    Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
2023-11-06 22:42:50.048980196    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
2023-11-06 22:42:50.048987170    Stream #0:1 -> #0:2 (aac (native) -> opus (libopus))
2023-11-06 22:42:50.048987911  Press [q] to stop, [?] for help
2023-11-06 22:42:50.050248514  [libopus @ 0x55c954feb2c0] No bit rate set. Defaulting to 64000 bps.
2023-11-06 22:42:50.094254583  [hevc @ 0x55c954f6dc80] Could not find ref with POC 1
2023-11-06 22:42:50.111037248  [libx264 @ 0x55c954f6eac0] frame MB size (256x96) > level limit (8192)
2023-11-06 22:42:50.111041126  [libx264 @ 0x55c954f6eac0] MB rate (491520) > level limit (245760)
2023-11-06 22:42:50.111537247  [libx264 @ 0x55c954f6eac0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
2023-11-06 22:42:50.112832726  [libx264 @ 0x55c954f6eac0] profile High, level 4.1, 4:2:0, 8-bit
2023-11-06 22:42:50.113222336  [libx264 @ 0x55c954f6eac0] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=50 keyint_min=5 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
2023-11-06 22:42:50.114197747  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/68107f4eba6b5b9b7fabb632d91850e4':
2023-11-06 22:42:50.114205883  22:42:50.114 DBG [exec] run launch=2.027861829s
2023-11-06 22:42:50.114224087    Metadata:
2023-11-06 22:42:50.114328235      title           : go2rtc/1.8.2
2023-11-06 22:42:50.114413838      encoder         : Lavf59.27.100
2023-11-06 22:42:50.114573781    Stream #0:0: Video: h264, yuv420p(tv, progressive), 4096x1536, q=2-31, 20 fps, 90k tbn
2023-11-06 22:42:50.114630980      Metadata:
2023-11-06 22:42:50.114724678        encoder         : Lavc59.37.100 libx264
2023-11-06 22:42:50.114780143      Side data:
2023-11-06 22:42:50.114909478        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
2023-11-06 22:42:50.115031650    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 69 kb/s (default)
2023-11-06 22:42:50.115094570      Metadata:
2023-11-06 22:42:50.115185983        encoder         : Lavc59.37.100 aac
2023-11-06 22:42:50.115283458    Stream #0:2: Audio: opus, 16000 Hz, mono, flt, 64 kb/s
2023-11-06 22:42:50.115350456      Metadata:
2023-11-06 22:42:50.115442570        encoder         : Lavc59.37.100 libopus
2023-11-06 22:42:57.100175307  frame=   23 fps=0.0 q=18.0 size=N/A time=00:00:01.20 bitrate=N/A dup=22 drop=0 speed= 791x    
frame=   33 fps=0.0 q=18.0 size=N/A time=00:00:01.70 bitrate=N/A dup=22 drop=0 speed=3.22x    
frame=   42 fps= 40 q=21.0 size=N/A time=00:00:02.22 bitrate=N/A dup=22 drop=0 speed=2.14x    
frame=   53 fps= 34 q=15.0 size=N/A time=00:00:02.74 bitrate=N/A dup=22 drop=0 speed=1.77x    
frame=   63 fps= 30 q=16.0 size=N/A time=00:00:03.24 bitrate=N/A dup=22 drop=0 speed=1.57x    
frame=   74 fps= 29 q=15.0 size=N/A time=00:00:03.76 bitrate=N/A dup=22 drop=0 speed=1.46x    
frame=   84 fps= 27 q=16.0 size=N/A time=00:00:04.26 bitrate=N/A dup=22 drop=0 speed=1.39x    
frame=   94 fps= 26 q=18.0 size=N/A time=00:00:04.78 bitrate=N/A dup=22 drop=0 speed=1.33x    
frame=  104 fps= 25 q=16.0 size=N/A time=00:00:05.30 bitrate=N/A dup=22 drop=0 speed=1.29x    
frame=  115 fps= 25 q=15.0 size=N/A time=00:00:05.80 bitrate=N/A dup=22 drop=0 speed=1.26x    
frame=  125 fps= 24 q=15.0 size=N/A time=00:00:06.32 bitrate=N/A dup=22 drop=0 speed=1.23x    
frame=  136 fps= 24 q=15.0 size=N/A time=00:00:06.82 bitrate=N/A dup=22 drop=0 speed=1.21x    
frame=  146 fps= 24 q=16.0 size=N/A time=00:00:07.40 bitrate=N/A dup=22 drop=0 speed=1.19x    
frame=  157 fps= 23 q=15.0 size=N/A time=00:00:07.92 bitrate=N/A dup=22 drop=0 speed=1.18x    
[INFO] Starting go2rtc healthcheck service...
2023-11-06 22:43:42.110628254  frame=  167 fps= 23 q=15.0 size=N/A time=00:00:08.42 bitrate=N/A dup=22 drop=0 speed=1.16x    
frame=  178 fps= 23 q=15.0 size=N/A time=00:00:09.00 bitrate=N/A dup=22 drop=0 speed=1.15x    
frame=  189 fps= 23 q=15.0 size=N/A time=00:00:09.52 bitrate=N/A dup=22 drop=0 speed=1.14x    
frame=  199 fps= 22 q=15.0 size=N/A time=00:00:10.02 bitrate=N/A dup=22 drop=0 speed=1.13x    
frame=  209 fps= 22 q=15.0 size=N/A time=00:00:10.54 bitrate=N/A dup=22 drop=0 speed=1.13x    
frame=  219 fps= 22 q=15.0 size=N/A time=00:00:11.06 bitrate=N/A dup=22 drop=0 speed=1.12x    
frame=  229 fps= 22 q=15.0 size=N/A time=00:00:11.56 bitrate=N/A dup=22 drop=0 speed=1.12x    
frame=  240 fps= 22 q=15.0 size=N/A time=00:00:12.08 bitrate=N/A dup=22 drop=0 speed=1.11x    
frame=  250 fps= 22 q=15.0 size=N/A time=00:00:12.58 bitrate=N/A dup=22 drop=0 speed= 1.1x    
frame=  260 fps= 22 q=15.0 size=N/A time=00:00:13.10 bitrate=N/A dup=22 drop=0 speed= 1.1x    
frame=  271 fps= 22 q=15.0 size=N/A time=00:00:13.62 bitrate=N/A dup=22 drop=0 speed= 1.1x    
frame=  281 fps= 22 q=18.0 size=N/A time=00:00:14.12 bitrate=N/A dup=22 drop=0 speed=1.09x    
frame=  292 fps= 22 q=21.0 size=N/A time=00:00:14.70 bitrate=N/A dup=22 drop=0 speed=1.09x    
frame=  302 fps= 22 q=17.0 size=N/A time=00:00:15.22 bitrate=N/A dup=22 drop=0 speed=1.09x    
frame=  314 fps= 22 q=15.0 size=N/A time=00:00:15.72 bitrate=N/A dup=22 drop=0 speed=1.08x    
frame=  324 fps= 22 q=16.0 size=N/A time=00:00:16.24 bitrate=N/A dup=22 drop=0 speed=1.08x    
frame=  334 fps= 21 q=15.0 size=N/A time=00:00:16.82 bitrate=N/A dup=22 drop=0 speed=1.08x    
frame=  345 fps= 21 q=17.0 size=N/A time=00:00:17.32 bitrate=N/A dup=22 drop=0 speed=1.07x    
frame=  355 fps= 21 q=15.0 size=N/A time=00:00:17.84 bitrate=N/A dup=22 drop=0 speed=1.07x    
frame=  365 fps= 21 q=15.0 size=N/A time=00:00:18.34 bitrate=N/A dup=22 drop=0 speed=1.07x    
frame=  376 fps= 21 q=15.0 size=N/A time=00:00:18.86 bitrate=N/A dup=22 drop=0 speed=1.07x    
frame=  386 fps= 21 q=15.0 size=N/A time=00:00:19.38 bitrate=N/A dup=22 drop=0 speed=1.07x    
frame=  396 fps= 21 q=16.0 size=N/A time=00:00:19.88 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  406 fps= 21 q=15.0 size=N/A time=00:00:20.40 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  417 fps= 21 q=15.0 size=N/A time=00:00:20.90 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  428 fps= 21 q=15.0 size=N/A time=00:00:21.42 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  437 fps= 21 q=15.0 size=N/A time=00:00:21.94 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  448 fps= 21 q=15.0 size=N/A time=00:00:22.44 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  457 fps= 21 q=15.0 size=N/A time=00:00:22.96 bitrate=N/A dup=22 drop=0 speed=1.06x    
frame=  468 fps= 21 q=15.0 size=N/A time=00:00:23.46 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  478 fps= 21 q=15.0 size=N/A time=00:00:23.98 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  488 fps= 21 q=15.0 size=N/A time=00:00:24.50 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  499 fps= 21 q=15.0 size=N/A time=00:00:25.00 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  509 fps= 21 q=15.0 size=N/A time=00:00:25.58 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  520 fps= 21 q=15.0 size=N/A time=00:00:26.10 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  531 fps= 21 q=15.0 size=N/A time=00:00:26.66 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  541 fps= 21 q=13.0 size=N/A time=00:00:27.18 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  552 fps= 21 q=15.0 size=N/A time=00:00:27.70 bitrate=N/A dup=22 drop=0 speed=1.05x    
frame=  562 fps= 21 q=17.0 size=N/A time=00:00:28.20 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  573 fps= 21 q=15.0 size=N/A time=00:00:28.72 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  583 fps= 21 q=16.0 size=N/A time=00:00:29.22 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  594 fps= 21 q=18.0 size=N/A time=00:00:29.80 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  605 fps= 21 q=16.0 size=N/A time=00:00:30.26 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  615 fps= 21 q=15.0 size=N/A time=00:00:30.82 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  625 fps= 21 q=16.0 size=N/A time=00:00:31.34 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  636 fps= 21 q=15.0 size=N/A time=00:00:31.92 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  647 fps= 21 q=16.0 size=N/A time=00:00:32.36 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  657 fps= 21 q=15.0 size=N/A time=00:00:32.94 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  667 fps= 21 q=15.0 size=N/A time=00:00:33.46 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  678 fps= 21 q=15.0 size=N/A time=00:00:33.90 bitrate=N/A dup=22 drop=0 speed=1.04x    
frame=  687 fps= 21 q=15.0 size=N/A time=00:00:34.42 bitrate=N/A dup=22 drop=0 speed=1.04x
NickM-27 commented 8 months ago

#hardware should be included, I forgot that. But as you are not using that stream for live view, there is no reason to have audio transcoding enabled

midget214 commented 8 months ago

Adding the hardware flag results in this error again

Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
2023-11-06 22:56:50.994702121  Error reinitializing filters!
2023-11-06 22:56:50.994703985  Failed to inject frame into filter network: Function not implemented
2023-11-06 22:56:50.994704997  Error while processing the decoded data for stream #0:0
NickM-27 commented 8 months ago

rtsp://127.0.0.1:8554/garage_front?video=h264&audio=aac&hardware=cuda is wrong by the way, you simply need ?video=h264&audio

NickM-27 commented 8 months ago

what resolution is your reolink main stream set to?

midget214 commented 8 months ago

The main stream has the following

Resolution : 4096 x 1536 FPS: 20 Max Bit Rate : 8192 Interframe Space : 1x

NickM-27 commented 8 months ago

Okay, that should be fine, not sure why the nvidia GPU is unhappy with it. What GPU and driver version?

midget214 commented 8 months ago

I have a Quadro p400. The driver version is quite old but its due to the fact that its a pain to update. I had this setup previously for emby and it worked so I didn't want to mess with it. The host is Proxmox

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.103.01   Driver Version: 470.103.01   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro P400         On   | 00000000:0F:00.0 Off |                  N/A |
| 34%   47C    P0    N/A /  N/A |    195MiB /  1998MiB |      3%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A    644193      C   ffmpeg                            125MiB |
|    0   N/A  N/A    644198      C   ffmpeg                             66MiB |
+-----------------------------------------------------------------------------+
NickM-27 commented 8 months ago

Yeah, something here seems unhappy, I've done some similar transcoding in the past with go2rtc and never saw any issues with my 3050

midget214 commented 8 months ago

I updated to v532 Nvidia drivers and the issue persists. Not sure what to try next

midget214 commented 8 months ago

I managed to find something that seems to work. I don't understand why - i just brute forced my way through it by adding / removing arguments. If I understand the command line args that seems to work correctly for me, the setup uses CPU to decode the 265 stream and the GPU to encode to h264. The overall system load seems fine with this. Very small additional CPU usage but the GPU is now getting used. The command that seems to work is below. The key differences are

ffmpeg -hide_banner -hwaccel_output_format cuda -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://127.0.0.1:8554/garage_front?video -vf "hwupload_cuda" -c:v h264_nvenc -g 50 -bf 0 -profile:v high -level:v auto -preset:v p2 -tune:v ll -an -user_agent ffmpeg/go2rtc -c:a copy test.mp4

Now I just need to figure out how to update my config so that frigate can execute this custom command line.

NickM-27 commented 8 months ago

go2rtc accepts full commands using the exec input, examples are in their docs

midget214 commented 8 months ago

I've finally managed to get this to work similarly to my debugging setup (partial decoding / encoding using CPU and GPU) I also renamed the camera from garage_front to garage_side incase someone is looking at the previous configs.

CPU usage went up slightly - from 3% - 7% to 12 %- 15% but the GPU is also up from 1% to 4% - so its working as expected.

go2rtc:
  log:
    exec: trace
  streams:
    garage_side: 
      - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.13.3:554/h265Preview_01_main
      - ffmpeg:garage_side#audio=aac#audio=opus

    garage_side_sub:
      - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@192.168.13.3:554/h264Preview_01_sub
      - ffmpeg:garage_side_sub#audio=aac#audio=opus

cameras:
  garage_side:
    ffmpeg:
      hwaccel_args: -hwaccel_output_format cuda
      output_args:
         record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -vf "hwupload_cuda" -c:v h264_nvenc
      inputs:
        - path: rtsp://127.0.0.1:8554/garage_side_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/garage_side
          input_args: preset-rtsp-restream
          roles:
            - record