mnakada / atomcam_tools

Hack tool for atomcam and wyzecam.
Other
178 stars 22 forks source link

SPS PPS not passed with 1080P stream, audio sample rate mismatch? #67

Closed baudneo closed 8 months ago

baudneo commented 1 year ago

Hi,

Thank you for your work!

I use Janus webrtc gateway to restream rtsp streams over webrtc. I am using wz_mini_hacks which uses your atomcam repo and v4lrtspserver to stream over rtsp.

There are 2 streams, 1 hi res 1080p and 1 low res 640x380. The low res stream supplies videofmtp: profile-level-id but the hi res stream does not. This causes janus to error out as it required video fmtp to be included in the describe response.

Here are the DESCRIBE responses.

Low res stream

v=0
o=- 1659831422573847 1 IN IP4 10.0.1.67
s=LIVE555 Streaming Media v2022.04.26
i=LIVE555 Streaming Media v2022.04.26
t=0 0
a=tool:LIVE555 Streaming Media v2022.04.26
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.04.26
a=x-qt-text-inf:LIVE555 Streaming Media v2022.04.26
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4d0032;sprop-parameter-sets=J00AMudAUBf8s1AQEB8AAAMAAQAAAwAoNGAE4gB1N//wKA==,KO48gA==
a=x-dimensions:640,360
a=control:track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:97 L16/44100
a=fmtp:97
a=control:track2

[janus-ZM] [Sat Aug  6 21:25:51 2022] SETUP answer:RTSP/1.0 200 OK
CSeq: 3
Date: Sun, Aug 07 2022 03:25:49 GMT
Transport: RTP/AVP;unicast;destination=10.0.1.7;source=10.0.1.67;client_port=10060-10061;server_port=6978-6979
Session: C128E013;timeout=65

[janus-ZM] [Sat Aug  6 21:25:51 2022]   -- Source (video): 10.0.1.67
[janus-ZM] [Sat Aug  6 21:25:51 2022]   -- RTP port (video): 6978
[janus-ZM] [Sat Aug  6 21:25:51 2022]   -- RTCP port (video): 6979
[janus-ZM] [Sat Aug  6 21:25:51 2022]   -- RTSP session timeout (video): 32000 ms
[janus-ZM] [Sat Aug  6 21:25:51 2022] RTSP video latching: 10.0.1.67:6978
[janus-ZM] [Sat Aug  6 21:25:51 2022]   -- RTCP: 10.0.1.67:6979
[janus-ZM] [Sat Aug  6 21:25:51 2022] Sending PLAY request...
[janus-ZM] [Sat Aug  6 21:25:51 2022] PLAY answer:RTSP/1.0 200 OK
CSeq: 4
Date: Sun, Aug 07 2022 03:25:49 GMT
Range: npt=0.000-
Session: C128E013
RTP-Info: url=rtsp://10.0.1.67:8554/video2_unicast/track1;seq=27647;rtptime=2856732743,url=rtsp://10.0.1.67:8554/video2_unicast/track2;seq=0;rtptime=0

High res stream

CSeq: 1
Date: Sun, Aug 07 2022 03:44:20 GMT
WWW-Authenticate: Digest realm="LIVE555 Streaming Media", nonce="2431aaa7fb9fa620e8665597fd90b059"

RTSP/1.0 200 OK
CSeq: 2
Date: Sun, Aug 07 2022 03:44:20 GMT
Content-Base: rtsp://10.0.1.67:8554/video1_unicast/
Content-Type: application/sdp
Content-Length: 563

v=0
o=- 1659831422316587 1 IN IP4 10.0.1.67
s=LIVE555 Streaming Media v2022.04.26
i=LIVE555 Streaming Media v2022.04.26
t=0 0
a=tool:LIVE555 Streaming Media v2022.04.26
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.04.26
a=x-qt-text-inf:LIVE555 Streaming Media v2022.04.26
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96
a=x-dimensions:1920,1080
a=control:track1
m=audio 0 RTP/AVP 97
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:97 L16/16000
a=fmtp:97
a=control:track2

[janus-ZM] [Sat Aug  6 21:44:22 2022] [ERR] [plugins/janus_streaming.c:janus_streaming_rtsp_parse_sdp:6349] [2] cannot parse video fmtp...
[janus-ZM] [Sat Aug  6 21:44:22 2022] [ERR] [plugins/janus_streaming.c:janus_streaming_process_synchronous_request:3254] Error creating 'rtsp' stream...

Substream (low res) is calling for profile 4d0032 which is Mainline.

The mainstream (high res) does not seem to call a profile at all which fails with janus outright.

The maintainer for v4lrtspserver has said that the SPS/PPS is not sent with the 1080P stream that can be decoded into a profile level id. Is there a way to force or override this?

Audio

Is the audio stream L16/16000/1 or L16/44100/1 ?

The audio track replies with L16/16000/1 when the audio is disabled. When the audio is enabled it replies with L16/44100/1. Just wondering which is correct?

Thank you.