mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.82k stars 423 forks source link

Video fmtp not set #298

Closed baudneo closed 6 months ago

baudneo commented 1 year ago

Hi,

I use wz mini hacks which uses this software to stream rtsp.

The main 1080p stream does not include the video fmtp param which causes janus to error out.

DESCRIBE response:

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

The line a=fmtp:96 is the problem, it does not include profile-level-id=<Profile id>

I did not see in the README where I can set that. Is it possible?

Thank you.

mpromonet commented 1 year ago

Hi,

I don't understand the point, the logs you show have a profile-level-id.

Best Regards, Michel.

baudneo commented 1 year ago

Hi,

Sorry, that was the wrong log entry, here are the logs of the one that fails. The first logs I posted are the sub-stream, these following logs are the mainstream.

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...

So the substream is successful becvause it has profile-level-id set but in the mainstream it fails due to no profile-level-id

mpromonet commented 1 year ago

Hi,

This is set https://github.com/mpromonet/v4l2rtspserver/blob/eaeda29aec14048ceaf11c2159b978f64cba4bf4/src/ServerMediaSubsession.cpp#L124 Using data are stored in https://github.com/mpromonet/v4l2rtspserver/blob/eaeda29aec14048ceaf11c2159b978f64cba4bf4/src/H264_V4l2DeviceSource.cpp#L63.

So it seems sps/pps are not found in the capture. Looking to the detail log may helps you to understand if it comes from your device, or an error in parsing.

Best Regards, Michel.

baudneo commented 1 year ago

Hi, So the setup using wyzecam_raw_stream -> v4l2compress -> v4l2loopback -> v4l2rtspserver -> rtsp client.

I have some log output using -vv in a gist. Here is where PPS and SPS show up for the first time in the logs. SPS and PPS being sent is for the video_2 (sub stream). The main stream PPS/SPS doesnt seem to be sent from the device. It is hard to differentiate the video_1 and video_2 log output.

I do not know C language, is there a way I can debug this farther? or possibly hardcode a profile-level-id and build?