Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Camera Support]: Restream with go2rtc ERROR: Could not find codec parameters for stream #9250

Closed
spygroove2002 opened this issue Jan 7, 2024 · 4 comments

Comments

@spygroove2002
Copy link

Describe the problem you are having

Hello,

in order to rotate the image of an camera, I would like to use go2rtc restream function. However, while I can sucessfully access the the go2rtc stream through my browser (i.e. , I'm not able to integrate it as frigate camera. On the Firgate log side I get a "Unable to read frames from ffmpeg process", in the go2rtc log side I get a "Could not find codec parameters for stream" error

  • There are several other cameras working nicely - didnt include in logs/config here
  • I upgraded to a custom go2rtc build to test if this changes anything, but wit the standard version I get the same error
  • The relevant restream can be sucessfully viewed in my browser under http://IP:5000/live/webrtc/stream.html?src=Garden_3_low_rotated

Go2rtc log

2024-01-07 22:36:18.053528086  [INFO] Preparing go2rtc config...
2024-01-07 22:36:18.085147631  [INFO] Got IP address from supervisor: 192.168.1.123
2024-01-07 22:36:18.122574373  [INFO] Got WebRTC port from supervisor: 8555
2024-01-07 22:36:18.377690546  [WARN] Using go2rtc binary from '/config/go2rtc' instead of the embedded one
2024-01-07 22:36:18.377695587  [INFO] Starting go2rtc...
2024-01-07 22:36:18.460939681  23:36:18.460 INF go2rtc version 1.8.5 linux/amd64
2024-01-07 22:36:18.461369634  23:36:18.461 INF [api] listen addr=:1984
2024-01-07 22:36:18.461400033  23:36:18.461 INF [rtsp] listen addr=:8554
2024-01-07 22:36:18.461577066  23:36:18.461 INF [webrtc] listen addr=:8555
2024-01-07 22:36:19.388948559  23:36:19.388 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/Garden_3_low?video -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -an -vf \"transpose=2\" -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2024-01-07 22:36:19.397606625  23:36:19.397 DBG [exec] run url="exec:ffmpeg -hide_banner -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://admin:123456@192.168.1.169:554/video2 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2024-01-07 22:36:21.951318875  Input #0, rtsp, from 'rtsp://xxx:xxx@192.168.1.169:554/video2':
2024-01-07 22:36:21.951322823    Metadata:
2024-01-07 22:36:21.951324598      title           : RTSP/RTP stream from icamra ipc
2024-01-07 22:36:21.951348298    Duration: N/A, start: 0.586000, bitrate: N/A
2024-01-07 22:36:21.951375426    Stream #0:0: Video: h264 (High), yuv420p(progressive), 720x480, 25 fps, 11.99 tbr, 90k tbn
2024-01-07 22:36:21.993403830  23:36:21.993 DBG [exec] run launch=2.595805498s
2024-01-07 22:36:21.993408976  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/b74c4547e9a8699aa37c72dccbdf71a5':
2024-01-07 22:36:21.993424263    Metadata:
2024-01-07 22:36:21.993426140      title           : RTSP/RTP stream from icamra ipc
2024-01-07 22:36:21.993427839      encoder         : Lavf59.27.100
2024-01-07 22:36:21.993453382    Stream #0:0: Video: h264 (High), yuv420p(progressive), 720x480, q=2-31, 25 fps, 11.99 tbr, 90k tbn
2024-01-07 22:36:21.993485598  Stream mapping:
2024-01-07 22:36:21.993487408    Stream #0:0 -> #0:0 (copy)
2024-01-07 22:36:21.993488986  Press [q] to stop, [?] for help
2024-01-07 22:36:27.104729577  frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=N/A    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
[rtsp @ 0x5560def74080] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
2024-01-07 22:36:27.104777712  Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
2024-01-07 22:36:27.106123081  Input #0, rtsp, from 'rtsp://127.0.0.1:8554/Garden_3_low?video':
2024-01-07 22:36:27.106132893    Metadata:
2024-01-07 22:36:27.106138130      title           : go2rtc/1.8.5
2024-01-07 22:36:27.106143077    Duration: N/A, bitrate: N/A
2024-01-07 22:36:27.106148008    Stream #0:0: Video: h264, none, 90k tbr, 90k tbn
2024-01-07 22:36:27.106366799  Output #0, rtsp, to 'rtsp://127.0.0.1:8554/1f85147ee6e3748f796193496aaa6819':
2024-01-07 22:36:27.106373349  Output file #0 does not contain any stream
2024-01-07 22:36:27.107849525  23:36:27.107 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/Garden_3_low?video -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -an -vf \"transpose=2\" -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2024-01-07 22:36:27.113415723  23:36:27.113 DBG [exec] run url="exec:ffmpeg -hide_banner -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://admin:123456@192.168.1.169:554/video2 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2024-01-07 22:36:27.385651093  frame=    0 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
av_interleaved_write_frame(): Broken pipe
2024-01-07 22:36:27.385888167  frame=    1 fps=0.2 q=-1.0 Lsize=N/A time=00:00:07.10 bitrate=N/A speed=1.32x    
2024-01-07 22:36:27.385898641  video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
2024-01-07 22:36:27.386763187  Conversion failed!
2024-01-07 22:36:27.389160847  23:36:27.388 TRC [exec] close url="exec:ffmpeg -hide_banner -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://admin:123456@192.168.1.169:554/video2 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
2024-01-07 22:36:28.052443511  [INFO] Starting go2rtc healthcheck service...


Version

0.12.1-367D724

Frigate config file

go2rtc:
  log:
    exec: trace
    
  streams:
    Garden_3_low:
      - ffmpeg:rtsp://xxx:xxx@192.168.1.169:554/video2

    Garden_3_low_rotated:
      - "ffmpeg:Garden_3_low#video=h264#rotate=270" 
 



#Global Object Settings
objects:
  track:
    - person

detectors:
  coral:
   type: edgetpu
   device: usb

    
cameras:
  Garden_3:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Garden_3_low_rotated
          input_args: preset-rtsp-restream
          roles:
            - detect
            - rtmp
            - record

    live:
      stream_name: Garden_3_low_rotated
    snapshots:
      enabled: True
    record:
      enabled: True
      events:
        retain:
          default: 50  
        post_capture: 10
        pre_capture: 5
    detect:
      width: 480 
      height: 720 
      fps: 25

Relevant log output

2024-01-07 22:36:18.051190523  [INFO] Starting Frigate...
2024-01-07 22:36:19.243886519  [2024-01-07 23:36:19] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2024-01-07 22:36:19.280772928  [2024-01-07 23:36:19] frigate.app                    INFO    : Creating directory: /tmp/cache
2024-01-07 22:36:19.282684878  [2024-01-07 23:36:19] peewee_migrate                 INFO    : Starting migrations
2024-01-07 22:36:19.286654003  [2024-01-07 23:36:19] peewee_migrate                 INFO    : There is nothing to migrate
2024-01-07 22:36:19.300692785  [2024-01-07 23:36:19] frigate.app                    INFO    : Output process started: 301
Camera processor started for Garden_3: 312
Capture process started for Garden_3: 322
2024-01-07 22:36:21.920038277  [2024-01-07 23:36:19] detector.coral                 INFO    : Starting detection process: 299
2024-01-07 22:36:21.924264423  [2024-01-07 23:36:19] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
2024-01-07 22:36:21.925144935  [2024-01-07 23:36:21] frigate.detectors.plugins.edgetpu_tfl INFO    : TPU found
2024-01-07 22:36:24.501557297  [2024-01-07 23:36:24] frigate.video                  ERROR   : Garden_3: Unable to read frames from ffmpeg process.
2024-01-07 22:36:24.501784503  [2024-01-07 23:36:24] frigate.video                  ERROR   : Garden_3: ffmpeg process is not running. exiting capture thread...
2024-01-07 22:36:39.400066530  [2024-01-07 23:36:39] watchdog.Garden_3              ERROR   : Ffmpeg process crashed unexpectedly for Garden_3.
2024-01-07 22:36:39.400180247  [2024-01-07 23:36:39] watchdog.Garden_3              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2024-01-07 22:36:39.400835733  [2024-01-07 23:36:39] ffmpeg.Garden_3.detect         ERROR   : rtsp://127.0.0.1:8554/Garden_3_low_rotated: Invalid data found when processing input
2024-01-07 22:36:44.523458579  [2024-01-07 23:36:44] frigate.video                  ERROR   : Garden_3: Unable to read frames from ffmpeg process.
2024-01-07 22:36:44.523616160  [2024-01-07 23:36:44] frigate.video                  ERROR   : Garden_3: ffmpeg process is not running. exiting capture thread...
2024-01-07 22:36:49.412991290  [2024-01-07 23:36:49] watchdog.Garden_3              ERROR   : Ffmpeg process crashed unexpectedly for Garden_3.
2024-01-07 22:36:49.413234506  [2024-01-07 23:36:49] watchdog.Garden_3              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2024-01-07 22:36:49.413374885  [2024-01-07 23:36:49] ffmpeg.Garden_3.detect         ERROR   : rtsp://127.0.0.1:8554/Garden_3_low_rotated: Invalid data found when processing input
2024-01-07 22:36:54.530011480  [2024-01-07 23:36:54] frigate.video                  ERROR   : Garden_3: Unable to read frames from ffmpeg process.
2024-01-07 22:36:54.530176781  [2024-01-07 23:36:54] frigate.video                  ERROR   : Garden_3: ffmpeg process is not running. exiting capture thread...

FFprobe output from your camera

no return

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

Noname

Any other information that may be helpful

No response

@NickM-27
Copy link
Sponsor Collaborator

NickM-27 commented Jan 8, 2024

you may try including audio

  streams:
    Garden_3_low:
      - ffmpeg:rtsp://xxx:xxx@192.168.1.169:554/video2

    Garden_3_low_rotated:
      - "ffmpeg:Garden_3_low#video=h264#rotate=270#audio=copy" 

by the way I'd suggest keeping the detect fps at 5, 24 is quite high and frigate does not benefit from such high fps. It does not need to match your cameras fps.

@spygroove2002
Copy link
Author

Doesn’t change it. Forgot to mention, it’s a video only stream and it doesn’t seem to be related to the rotation neither. The camera also doesn’t work if I point it to the Garden_3_low stream.

@NickM-27
Copy link
Sponsor Collaborator

seems like the camera is sending bad data in a form that ffmpeg is not able to handle it

Copy link

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 github-actions bot added the stale label Feb 12, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants