AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.24k stars 346 forks source link

Restore fix for Chinese buggy cameras #607

Closed Calcu2006 closed 1 year ago

Calcu2006 commented 1 year ago

HI,

I installed yesterday this version 1.7.0, and:

1.- it's sttopping 2 secons later i start it.

i saw this error:

panic: runtime error: index out of range [4] with length 0

goroutine 26 [running]:
github.com/AlexxIT/go2rtc/pkg/h264.NALUType(...)
    github.com/AlexxIT/go2rtc/pkg/h264/h264.go:23
github.com/AlexxIT/go2rtc/pkg/h264.IsKeyframe(...)
    github.com/AlexxIT/go2rtc/pkg/h264/h264.go:29
github.com/AlexxIT/go2rtc/pkg/mp4.(*Consumer).AddTrack.func1(0x40001c8000?)
    github.com/AlexxIT/go2rtc/pkg/mp4/consumer.go:68 +0x1e4
github.com/AlexxIT/go2rtc/pkg/h264.RTPDepay.func1(0x400020a480)
    github.com/AlexxIT/go2rtc/pkg/h264/rtp.go:94 +0x314
github.com/AlexxIT/go2rtc/pkg/core.(*Sender).HandleRTP.func1()
    github.com/AlexxIT/go2rtc/pkg/core/track.go:146 +0x90
created by github.com/AlexxIT/go2rtc/pkg/core.(*Sender).HandleRTP in goroutine 54
    github.com/AlexxIT/go2rtc/pkg/core/track.go:140 +0x424

2.- there is any possibility to downgrade the version?

Can i send any log? how it's the best way? what must i activate to?

Edit:

Attached log from 2 cameras:


12:58:37.800 DBG [webrtc] add consumer error="streams: codecs not matched: H265, AAC => VP8, RTX, VP9, H264, OPUS, G722, PCMU, PCMA, TELEPHONE-EVENT, S16B, S16L"
12:58:37.800 DBG [streams] start producer url=rtsp://admin:xxx@192.168.1.107:554/cam/realmonitor?channel=1&subtype=0
12:58:50.922 DBG [streams] stop producer url=rtsp://admin:xxx@192.168.1.107:554/cam/realmonitor?channel=1&subtype=0
12:58:56.726 DBG [webrtc] new consumer src=CamComedorgo
12:58:56.797 DBG [webrtc] add consumer error="streams: codecs not matched: H265, AAC => VP8, RTX, VP9, H264, OPUS, G722, PCMU, PCMA, TELEPHONE-EVENT, S16B, S16L"
12:58:56.798 DBG [streams] start producer url=rtsp://admin:xxx@192.168.1.107:554/cam/realmonitor?channel=1&subtype=0
12:59:03.752 DBG [streams] stop producer url=rtsp://admin:xxx@192.168.1.107:554/cam/realmonitor?channel=1&subtype=0
12:59:23.708 DBG [webrtc] new consumer src=Mirilla
12:59:23.800 DBG [streams] start producer url=rtsp://192.168.1.37:554/live/ch00_0
panic: runtime error: index out of range [4] with length 0

goroutine 139 [running]:
github.com/AlexxIT/go2rtc/pkg/h264.NALUType(...)
    github.com/AlexxIT/go2rtc/pkg/h264/h264.go:23
github.com/AlexxIT/go2rtc/pkg/h264.IsKeyframe(...)
    github.com/AlexxIT/go2rtc/pkg/h264/h264.go:29
github.com/AlexxIT/go2rtc/pkg/mp4.(*Consumer).AddTrack.func1(0x40003d2000?)
    github.com/AlexxIT/go2rtc/pkg/mp4/consumer.go:68 +0x1e4
github.com/AlexxIT/go2rtc/pkg/h264.RTPDepay.func1(0x4000422360)
    github.com/AlexxIT/go2rtc/pkg/h264/rtp.go:94 +0x314
github.com/AlexxIT/go2rtc/pkg/core.(*Sender).HandleRTP.func1()
    github.com/AlexxIT/go2rtc/pkg/core/track.go:146 +0x90
created by github.com/AlexxIT/go2rtc/pkg/core.(*Sender).HandleRTP in goroutine 131
    github.com/AlexxIT/go2rtc/pkg/core/track.go:140 +0x424

Thanks in advance

czerwony03 commented 1 year ago

Hi, same issue on my side

AlexxIT commented 1 year ago

What's your camera model? Can you share stream with me as described in wiki?

Calcu2006 commented 1 year ago

Hi,

his one:

new consumer src=CamComedorgo
12:58:56.797 DBG [webrtc] add consumer error="streams: codecs not matched: H265, AAC => VP8, RTX, VP9, H264, OPUS, G722, PCMU, PCMA, TELEPHONE-EVENT, S16B, S16L"
12:58:56.798 DBG [streams] start producer url=rtsp://admin:xxx@192.168.1.107:554/cam/realmonitor?channel=1&subtype=0

Is a Imou Ranger 2, (IPC-A22E)

And this one:

12:59:23.708 DBG [webrtc] new consumer src=Mirilla
12:59:23.800 DBG [streams] start producer url=rtsp://192.168.1.37:554/live/ch00_0
panic: runtime error: index out of range [4] with length 0

It's a chinese door camera, like this:

https://es.aliexpress.com/item/4000429796084.html?spm=a2g0o.productlist.main.13.16564b36UlDwIZ&algo_pvid=c38c1956-496e-4b23-9251-908f6f68e243&algo_exp_id=c38c1956-496e-4b23-9251-908f6f68e243-6&pdp_npi=4%40dis%21EUR%2170.14%2149.1%21%21%2173.83%21%21%4021038ede16938072763121859e4cfb%2110000013757237002%21sea%21ES%21143910373%21&curPageLogUid=TNvdG5KUjn8o

I will try to share an stream later (time to go to work now xD)

AlexxIT commented 1 year ago

Yes. Cameras with wrong RTSP realisation /live/ch00_0. Maybe I have broke fix for them in latest version. I need to get stream to know what is wrong.

Calcu2006 commented 1 year ago

Hi, sorry, but i can not find in wiki how to give you Stream, can you tell me the url where I can find it ?

AlexxIT commented 1 year ago

https://github.com/AlexxIT/go2rtc/wiki/Tunnel-RTSP-camera-to-Intenet

You can find my contacts in the github profile

AlexxIT commented 1 year ago

Fix in latest master version

Calcu2006 commented 1 year ago

great! i was trying to do the ngrok thing, I will do it later just if still needed

AlexxIT commented 1 year ago

I have found another user with same problem

Calcu2006 commented 1 year ago

Ok, installed last version of go2rtc.

add-on is closing and no auto camera detected on Streams, the log:

Created the camera manually.

That's what i have in go2rtc.yaml:

hass:

streams:
    MirillaGo:  
       - rtsp://192.168.1.37:554/live/ch00_0#backchannel=0#media=video
    CamComedorGo:
       - rtsp://admin:xxxx@192.168.1.107:554/cam/realmonitor?channel=1&subtype=0#backchannel=0#media=video

log:
  level: info  # default level
  api: debug
  exec: debug
  rtsp: debug
  streams: debug
  webrtc: debug

Log when trying to see it:


21:47:11.807 INF go2rtc version 1.7.0 linux/arm64
21:47:11.815 INF [api] listen addr=0.0.0.0:1984
21:47:11.819 INF [rtsp] listen addr=0.0.0.0:8554
21:47:11.828 INF [webrtc] listen addr=0.0.0.0:8555/tcp
21:47:19.551 INF [streams] create new stream url=rtsp://admin:xxx@192.168.1.37/live/ch00_0
21:47:19.551 INF [streams] create new stream url=rtsp://admin:xxx@192.168.1.37/live/ch00_0
21:47:19.552 DBG [webrtc] new consumer src=rtsp://admin:xxx@192.168.1.37/live/ch00_0
21:47:19.725 DBG [streams] start producer url=rtsp://admin:xxx@192.168.1.37/live/ch00_0
panic: runtime error: index out of range [4] with length 0

goroutine 48 [running]:
github.com/AlexxIT/go2rtc/pkg/h264.NALUType(...)
    github.com/AlexxIT/go2rtc/pkg/h264/h264.go:23
github.com/AlexxIT/go2rtc/pkg/h264.IsKeyframe(...)
    github.com/AlexxIT/go2rtc/pkg/h264/h264.go:29
github.com/AlexxIT/go2rtc/pkg/mp4.(*Consumer).AddTrack.func1(0x4000190000?)
    github.com/AlexxIT/go2rtc/pkg/mp4/consumer.go:68 +0x1e4
github.com/AlexxIT/go2rtc/pkg/h264.RTPDepay.func1(0x400023ee10)
    github.com/AlexxIT/go2rtc/pkg/h264/rtp.go:94 +0x314
github.com/AlexxIT/go2rtc/pkg/core.(*Sender).HandleRTP.func1()
    github.com/AlexxIT/go2rtc/pkg/core/track.go:146 +0x90
created by github.com/AlexxIT/go2rtc/pkg/core.(*Sender).HandleRTP in goroutine 52
    github.com/AlexxIT/go2rtc/pkg/core/track.go:140 +0x424

The Imou is Fixed, it works. The chinese door camera is not working and showing this error.

Calcu2006 commented 1 year ago

Ok, final status:

Cameras from Home assistant are appearing in the streams part of go2rtc. Imou camera is fixed The only thing missing is this chinese camera that hangs go2rtc when i try to see it, Home assistant restars the add-on, but maybe it will be good to implement some kind of error watching for output the error but not hanging the add-on ?

I sent the ngrok url via telegram to you, i think it's done fine i tried and i can see it open.

Calcu2006 commented 1 year ago

Solved with last fix and tested with master branch.

Closing the issue.

Thanks !

AlexxIT commented 1 year ago

https://github.com/AlexxIT/go2rtc/releases/tag/v1.7.1