bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
12.27k stars 1.53k forks source link

MPEG4Audio panic. #3590

Closed asherAbecasiss closed 2 months ago

asherAbecasiss commented 3 months ago

Which version are you using?

v0.0.0

Which operating system are you using?

Describe the issue

app crashing

Describe how to replicate the issue

Hi. I run ffprobe on a rtsp camera result:

ffprobe version 6.1.1-3ubuntu5 Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)
  configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared --enable-version3 --disable-doc --disable-programs --disable-static --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, rtsp, from 'rtsp://admin:lxxx@10.20.102.225:554/profile1':
  Metadata:
    title           : profile1
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn
  Stream #0:1: Audio: aac, 16000 Hz, mono, fltp

app crashing: It looks like audio issues, app result crashing:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb290b8]

goroutine 12 [running]:
github.com/bluenviron/gortsplib/v4/pkg/format.(*MPEG4Audio).GetConfig(...)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.2/pkg/format/mpeg4_audio.go:331
github.com/bluenviron/mediamtx/internal/record.(*formatMPEGTS).initialize(0xc0004a1140)
        /home/asher/repo/mediamtx/internal/record/format_mpegts.go:229 +0x818
github.com/bluenviron/mediamtx/internal/record.(*agentInstance).initialize(0xc00042a840)
        /home/asher/repo/mediamtx/internal/record/agent_instance.go:50 +0x1e2
github.com/bluenviron/mediamtx/internal/record.(*Agent).Initialize(0xc00068e870)
        /home/asher/repo/mediamtx/internal/record/agent.go:58 +0x12e
github.com/bluenviron/mediamtx/internal/core.(*path).startRecording(0xc0005c6400)
        /home/asher/repo/mediamtx/internal/core/path.go:819 +0x1ac
github.com/bluenviron/mediamtx/internal/core.(*path).setReady(0xc0005c6400, 0xc00040c0a0, 0x0)
        /home/asher/repo/mediamtx/internal/core/path.go:725 +0x11d
github.com/bluenviron/mediamtx/internal/core.(*path).doSourceStaticSetReady(0xc0005c6400, {0xc00040c0a0?, 0x48?, 0xc0003722a0?})
        /home/asher/repo/mediamtx/internal/core/path.go:381 +0x45
github.com/bluenviron/mediamtx/internal/core.(*path).runInner(0xc0005c6400)
        /home/asher/repo/mediamtx/internal/core/path.go:269 +0x759
github.com/bluenviron/mediamtx/internal/core.(*path).run(0xc0005c6400)
        /home/asher/repo/mediamtx/internal/core/path.go:195 +0x31b
created by github.com/bluenviron/mediamtx/internal/core.(*path).initialize in goroutine 1
        /home/asher/repo/mediamtx/internal/core/path.go:145 +0x5ac
exit status 2

Did you attach the server logs?

yes

Did you attach a network dump?

yes

aler9 commented 3 months ago

Hello, please provide server logs with logLevel: debug as mentioned in the instructions, otherwise we are obliged to drop support for that specific camera.

asherAbecasiss commented 3 months ago

Hello, please provide server logs with logLevel: debug as mentioned in the instructions, otherwise we are obliged to drop support for that specific camera.

2024/08/02 10:37:09 INF MediaMTX v0.0.0
2024/08/02 10:37:09 INF configuration loaded from /home/asher/repo/mediamtx/mediamtx.yml
2024/08/02 10:37:09 DEB [path a3] created
2024/08/02 10:37:09 DEB [path a4] created
2024/08/02 10:37:09 DEB path manager created
2024/08/02 10:37:09 INF [path a4] [RTSP source] started
2024/08/02 10:37:09 INF [path a3] [RTSP source] started
2024/08/02 10:37:09 DEB [path a4] [RTSP source] connecting
2024/08/02 10:37:09 DEB [path a3] [RTSP source] connecting
2024/08/02 10:37:09 INF [RTSP] listener opened on :8556 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2024/08/02 10:37:09 INF [RTMP] listener opened on :1935
2024/08/02 10:37:09 INF [HLS] listener opened on :8888
2024/08/02 10:37:09 INF [WebRTC] listener opened on :8889 (HTTP), :8189 (ICE/UDP)
2024/08/02 10:37:09 INF [SRT] listener opened on :8890 (UDP)
2024/08/02 10:37:09 DEB [path a3] [RTSP source] [c->s] OPTIONS rtsp://x.x.x.x:554/profile1 RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [c->s] OPTIONS rtsp://x.x.x.x:554/profile1 RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Server: Customer RTSP Server/1.0.0

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [c->s] DESCRIBE rtsp://x.x.x.x:554/profile1 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a3] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Server: Customer RTSP Server/1.0.0

2024/08/02 10:37:09 DEB [path a3] [RTSP source] [c->s] DESCRIBE rtsp://x.x.x.x:554/profile1 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a3] [RTSP source] [s->c] RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Fri, Aug 02 2024 07:37:10 GMT
Expires: Fri, Aug 02 2024 07:37:10 GMT
WWW-Authenticate: Digest realm="RTSP SERVER", nonce="2f111f40b455663b13d46c9f706671e5", stale="FALSE"

2024/08/02 10:37:09 DEB [path a3] [RTSP source] [c->s] DESCRIBE rtsp://x.x.x.x:554/profile1 RTSP/1.0
Accept: application/sdp
Authorization: Digest username="admin", realm="RTSP SERVER", nonce="2f111f40b455663b13d46c9f706671e5", uri="rtsp://x.x.x.x:554/profile1", response="e60b9ce6b6bd1a23b235dccf2e8d807b"
CSeq: 3
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 2
Cache-Control: must-revalidate
Content-Base: rtsp://x.x.x.x:554/profile1/
Content-Length: 488
Content-Type: application/sdp
Date: Fri, Aug 02 2024 07:37:10 GMT
Expires: Fri, Aug 02 2024 07:37:10 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
X-Accept-Dynamic-Rate: 1
X-Accept-Retransmit: our-retransmit

v=0
o=- 1722584230169163 1 IN IP4 x.x.x.x
s=profile1
u=http:///
e=admin@
t=0 0
a=control:*
a=range:npt=00.000- 
m=video 0 RTP/AVP 96
b=AS:5000
a=control:track1
a=rtpmap:96 H264/90000
a=recvonly
a=fmtp:96 profile-level-id=674d00; sprop-parameter-sets=Z00AM4qVQPAET8s3AQEBQAAA+gAAMNQB,aO48gA==; packetization-mode=1
m=audio 0 RTP/AVP 97
b=AS:1000
a=control:track2
a=rtpmap:97 MP4A-LATM/16000/1
a=fmtp:40 profile-level-id=1717633800;cpresent=0;config=
a=sendonly

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [c->s] SETUP rtsp://x.x.x.x:554/profile1/track1 RTSP/1.0
CSeq: 3
Transport: RTP/AVP;unicast;client_port=46002-46003;mode=play
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 3
Cache-Control: must-revalidate
Date: Fri, Aug 02 2024 07:37:10 GMT
Expires: Fri, Aug 02 2024 07:37:10 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
Session: 457918751669614;timeout=60
Transport: RTP/AVP;unicast;destination=x.x.x.x;source=x.x.x.x;client_port=46002-46003;server_port=20220-20221;ssrc=1d8b8771

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [c->s] SETUP rtsp://x.x.x.x:554/profile1/track2 RTSP/1.0
CSeq: 4
Require: www.onvif.org/ver20/backchannel
Session: 457918751669614
Transport: RTP/AVP;unicast;client_port=35994-35995;mode=play
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a3] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 3
Cache-Control: must-revalidate
Content-Base: rtsp://x.x.x.x:554/profile1/
Content-Length: 492
Content-Type: application/sdp
Date: Fri, Aug 02 2024 07:37:10 GMT
Expires: Fri, Aug 02 2024 07:37:10 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
X-Accept-Dynamic-Rate: 1
X-Accept-Retransmit: our-retransmit

v=0
o=- 1722584230492885 1 IN IP4 x.x.x.x
s=profile1
u=http:///
e=admin@
t=0 0
a=control:*
a=range:npt=00.000- 
m=video 0 RTP/AVP 96
b=AS:5000
a=control:track1
a=rtpmap:96 H264/90000
a=recvonly
a=fmtp:96 profile-level-id=676400; sprop-parameter-sets=Z2QAM6wVKoHgCJ+WbgICAoAAAfQAAGGoAg==,aO48sA==; packetization-mode=1
m=audio 0 RTP/AVP 97
b=AS:1000
a=control:track2
a=rtpmap:97 MP4A-LATM/16000/1
a=fmtp:40 profile-level-id=1709392648;cpresent=0;config=
a=sendonly

2024/08/02 10:37:09 DEB [path a3] [RTSP source] [c->s] SETUP rtsp://x.x.x.x:554/profile1/track1 RTSP/1.0
Authorization: Digest username="admin", realm="RTSP SERVER", nonce="2f111f40bs556s3b13d46c9f706671e5", uri="rtsp://x.x.x.x:554/profile1/track1", response="0a8ed0bc0db00824a9ed442c1e009124"
CSeq: 4
Transport: RTP/AVP;unicast;client_port=57820-57821;mode=play
User-Agent: gortsplib

2024/08/02 10:37:09 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 4
Cache-Control: must-revalidate
Date: Fri, Aug 02 2024 07:37:10 GMT
Expires: Fri, Aug 02 2024 07:37:10 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
Session: 457918751669614;timeout=60
Transport: RTP/AVP;unicast;destination=x.x.x.x;source=x.x.x.x;client_port=35994-35995;server_port=20222-20223;ssrc=12c9aeaf

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb290b8]

goroutine 55 [running]:
github.com/bluenviron/gortsplib/v4/pkg/format.(*MPEG4Audio).GetConfig(...)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.2/pkg/format/mpeg4_audio.go:331
github.com/bluenviron/mediamtx/internal/record.(*formatMPEGTS).initialize(0xc000806f90)
        /home/asher/repo/mediamtx/internal/record/format_mpegts.go:229 +0x818
github.com/bluenviron/mediamtx/internal/record.(*agentInstance).initialize(0xc000814b80)
        /home/asher/repo/mediamtx/internal/record/agent_instance.go:50 +0x1e2
github.com/bluenviron/mediamtx/internal/record.(*Agent).Initialize(0xc0003fe870)
        /home/asher/repo/mediamtx/internal/record/agent.go:58 +0x12e
github.com/bluenviron/mediamtx/internal/core.(*path).startRecording(0xc0004cea00)
        /home/asher/repo/mediamtx/internal/core/path.go:819 +0x1ac
github.com/bluenviron/mediamtx/internal/core.(*path).setReady(0xc0004cea00, 0xc0004851d0, 0x0)
        /home/asher/repo/mediamtx/internal/core/path.go:725 +0x11d
github.com/bluenviron/mediamtx/internal/core.(*path).doSourceStaticSetReady(0xc0004cea00, {0xc0004851d0?, 0xd8?, 0xc000526660?})
        /home/asher/repo/mediamtx/internal/core/path.go:381 +0x45
github.com/bluenviron/mediamtx/internal/core.(*path).runInner(0xc0004cea00)
        /home/asher/repo/mediamtx/internal/core/path.go:269 +0x759
github.com/bluenviron/mediamtx/internal/core.(*path).run(0xc0004cea00)
        /home/asher/repo/mediamtx/internal/core/path.go:195 +0x31b
created by github.com/bluenviron/mediamtx/internal/core.(*path).initialize in goroutine 1
        /home/asher/repo/mediamtx/internal/core/path.go:145 +0x5ac
exit status 2
asherAbecasiss commented 3 months ago

after your last commit.

github.com/bluenviron/gortsplib/v4/pkg/format.(*MPEG4Audio).ClockRate(0xc000693508?)
2024/08/02 10:57:04 INF MediaMTX v0.0.0
2024/08/02 10:57:04 INF configuration loaded from /home/asher/repo/mediamtx/mediamtx.yml
2024/08/02 10:57:04 DEB [path a3] created
2024/08/02 10:57:04 DEB [path a4] created
2024/08/02 10:57:04 DEB path manager created
2024/08/02 10:57:04 INF [path a3] [RTSP source] started
2024/08/02 10:57:04 INF [path a4] [RTSP source] started
2024/08/02 10:57:04 DEB [path a3] [RTSP source] connecting
2024/08/02 10:57:04 DEB [path a4] [RTSP source] connecting
2024/08/02 10:57:04 INF [RTSP] listener opened on :8556 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2024/08/02 10:57:04 INF [RTMP] listener opened on :1935
2024/08/02 10:57:04 INF [HLS] listener opened on :8888
2024/08/02 10:57:04 INF [WebRTC] listener opened on :8889 (HTTP), :8189 (ICE/UDP)
2024/08/02 10:57:04 INF [SRT] listener opened on :8890 (UDP)
2024/08/02 10:57:04 DEB [path a4] [RTSP source] [c->s] OPTIONS rtsp://x.x.x.x:554/profile1 RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [c->s] OPTIONS rtsp://x.x.x.x:554/profile1 RTSP/1.0
CSeq: 1
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Server: Customer RTSP Server/1.0.0

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [c->s] DESCRIBE rtsp://x.x.x.x:554/profile1 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
Server: Customer RTSP Server/1.0.0

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [c->s] DESCRIBE rtsp://x.x.x.x:554/profile1 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 2
Cache-Control: must-revalidate
Content-Base: rtsp://x.x.x.x:554/profile1/
Content-Length: 488
Content-Type: application/sdp
Date: Fri, Aug 02 2024 07:57:05 GMT
Expires: Fri, Aug 02 2024 07:57:05 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
X-Accept-Dynamic-Rate: 1
X-Accept-Retransmit: our-retransmit

v=0
o=- 1722585425185381 1 IN IP4 x.x.x.x
s=profile1
u=http:///
e=admin@
t=0 0
a=control:*
a=range:npt=00.000- 
m=video 0 RTP/AVP 96
b=AS:5000
a=control:track1
a=rtpmap:96 H264/90000
a=recvonly
a=fmtp:96 profile-level-id=674d00; sprop-parameter-sets=Z00AM4qVQPAET8s3AQEBQAAA+gAAMNQB,aO48gA==; packetization-mode=1
m=audio 0 RTP/AVP 97
b=AS:1000
a=control:track2
a=rtpmap:97 MP4A-LATM/16000/1
a=fmtp:40 profile-level-id=1717633800;cpresent=0;config=
a=sendonly

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [c->s] SETUP rtsp://x.x.x.x:554/profile1/track1 RTSP/1.0
CSeq: 3
Transport: RTP/AVP;unicast;client_port=12260-12261;mode=play
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [s->c] RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Fri, Aug 02 2024 07:57:05 GMT
Expires: Fri, Aug 02 2024 07:57:05 GMT
WWW-Authenticate: Digest realm="RTSP SERVER", nonce="9634de26b0ceed2214868bbf52970357", stale="FALSE"

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [c->s] DESCRIBE rtsp://x.x.x.x:554/profile1 RTSP/1.0
Accept: application/sdp
Authorization: Digest username="admin", realm="RTSP SERVER", nonce="9634de26b0ceed2214868bbf52970357", uri="rtsp://x.x.x.x:554/profile1", response="4030c04bd79f11f51e99be7571b4f395"
CSeq: 3
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 3
Cache-Control: must-revalidate
Content-Base: rtsp://x.x.x.x:554/profile1/
Content-Length: 492
Content-Type: application/sdp
Date: Fri, Aug 02 2024 07:57:05 GMT
Expires: Fri, Aug 02 2024 07:57:05 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
X-Accept-Dynamic-Rate: 1
X-Accept-Retransmit: our-retransmit

v=0
o=- 1722585425523879 1 IN IP4 x.x.x.x
s=profile1
u=http:///
e=admin@
t=0 0
a=control:*
a=range:npt=00.000- 
m=video 0 RTP/AVP 96
b=AS:5000
a=control:track1
a=rtpmap:96 H264/90000
a=recvonly
a=fmtp:96 profile-level-id=676400; sprop-parameter-sets=Z2QAM6wVKoHgCJ+WbgICAoAAAfQAAGGoAg==,aO48sA==; packetization-mode=1
m=audio 0 RTP/AVP 97
b=AS:1000
a=control:track2
a=rtpmap:97 MP4A-LATM/16000/1
a=fmtp:40 profile-level-id=1709392648;cpresent=0;config=
a=sendonly

2024/08/02 10:57:04 DEB [path a3] [RTSP source] [c->s] SETUP rtsp://x.x.x.x:554/profile1/track1 RTSP/1.0
Authorization: Digest username="admin", realm="RTSP SERVER", nonce="9634de26b0ceed2214868bbf52970357", uri="rtsp://x.x.x.x:554/profile1/track1", response="fa983fa0b5301e75826ff0aa4a3b0efa"
CSeq: 4
Transport: RTP/AVP;unicast;client_port=20418-20419;mode=play
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 3
Cache-Control: must-revalidate
Date: Fri, Aug 02 2024 07:57:05 GMT
Expires: Fri, Aug 02 2024 07:57:05 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
Session: 462456176513227;timeout=60
Transport: RTP/AVP;unicast;destination=x.x.x.x;source=x.x.x.x;client_port=12260-12261;server_port=20224-20225;ssrc=7ccd454a

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [c->s] SETUP rtsp://x.x.x.x:554/profile1/track2 RTSP/1.0
CSeq: 4
Require: www.onvif.org/ver20/backchannel
Session: 462456176513227
Transport: RTP/AVP;unicast;client_port=58148-58149;mode=play
User-Agent: gortsplib

2024/08/02 10:57:04 DEB [path a4] [RTSP source] [s->c] RTSP/1.0 200 OK
CSeq: 4
Cache-Control: must-revalidate
Date: Fri, Aug 02 2024 07:57:05 GMT
Expires: Fri, Aug 02 2024 07:57:05 GMT
Last-Modified: Thu Jan  3 14:07:16 2019 GMT
Server: Customer RTSP Server/1.0.0
Session: 462456176513227;timeout=60
Transport: RTP/AVP;unicast;destination=x.x.x.x;source=x.x.x.x;client_port=58148-58149;server_port=20226-20227;ssrc=3b137d35

2024/08/02 10:57:04 WAR [path a4] [record] skipping MPEG-4 audio track: tracks without explicit configuration are not supported
2024/08/02 10:57:04 INF [path a4] [record] recording 1 track (H264)
2024/08/02 10:57:04 INF [path a4] [RTSP source] ready: 2 tracks (H264, MPEG-4 Audio)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7ff292]

goroutine 114 [running]:
github.com/bluenviron/gortsplib/v4/pkg/format.(*MPEG4Audio).ClockRate(0xc000693508?)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/pkg/format/mpeg4_audio.go:177 +0x12
github.com/bluenviron/gortsplib/v4.(*clientFormat).start(0xc00043ae80)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client_format.go:31 +0x46
github.com/bluenviron/gortsplib/v4.(*clientMedia).start(0xc0002541c0)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client_media.go:125 +0x6d4
github.com/bluenviron/gortsplib/v4.(*Client).startReadRoutines(0xc0005c2008)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client.go:804 +0x174
github.com/bluenviron/gortsplib/v4.(*Client).doPlay(0xc0005c2008, 0x0)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client.go:1620 +0x165
github.com/bluenviron/gortsplib/v4.(*Client).runInner(0xc0005c2008)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client.go:546 +0x673
github.com/bluenviron/gortsplib/v4.(*Client).run(0xc0005c2008)
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client.go:503 +0x55
created by github.com/bluenviron/gortsplib/v4.(*Client).Start in goroutine 83
        /home/asher/go/pkg/mod/github.com/bluenviron/gortsplib/v4@v4.10.3-0.20240801095652-e2d1e6dab418/client.go:449 +0x8fb
exit status 2
aler9 commented 3 months ago

@asherAbecasiss thanks for posting the full log.

Regarding the crash, it should be gone with the latest commit (67198cc).

Regarding support for the camera, the problem is that the camera is advertising an AAC track with the cpresent attribute set to "0" and no configuration:

a=control:track2
a=rtpmap:97 MP4A-LATM/16000/1
a=fmtp:40 profile-level-id=1709392648;cpresent=0;config=
a=sendonly

The RFC6416 specification says that

"cpresent": a boolean parameter that indicates whether audio payload configuration data has been multiplexed into an RTP payload (see Section 6.1). A 0 indicates the configuration data has not been multiplexed into an RTP payload, and in that case, the "config" parameter MUST be present

Therefore, the RTSP implementation of the server you're interacting with is wrong - is it a camera or a custom server? if it's a custom server, change the code. Otherwise, if it's a camera and nothing can be touched, provide the model and we'll see what we can do about it.

github-actions[bot] commented 3 months ago

This issue is mentioned in release v1.8.5 🚀 Check out the entire changelog by clicking here

aler9 commented 2 months ago

closed since no additional feedback was provided.