mpromonet / v4l2rtspserver

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

SPS/PPS missing on Describe #285

Closed cedricve closed 1 year ago

cedricve commented 2 years ago

Hey @mpromonet amazing work here!

I'm using the joy4 library and noticed that the Describe method using your RTSP server is missing codec information (which is unexpected and is deviating from the RFC). Is there any particular reason for this?

https://github.com/kerberos-io/joy4/blob/master/format/rtsp/client.go#L664

We receive something like this:

v=0
o=- 1656233372976675 1 IN IP4 192.168.1.234
s=LIVE555 Streaming Media v2022.06.16
i=LIVE555 Streaming Media v2022.06.16
t=0 0
a=tool:LIVE555 Streaming Media v2022.06.16
a=type:broadcast
a=control:*
a=range:npt=now-
a=x-qt-text-nam:LIVE555 Streaming Media v2022.06.16
a=x-qt-text-inf:LIVE555 Streaming Media v2022.06.16
m=video 0 RTP/AVP 26
c=IN IP4 0.0.0.0
b=AS:500
a=fmtp:26 
a=x-dimensions:1280,960
a=control:track1

But would expect to have an a=rtmap record for the codec like this.

< v=0
o=- 16601003535168796699 16601003535168796699 IN IP4 kerberos
s=Unnamed
i=N/A
c=IN IP4 0.0.0.0
t=0 0
a=tool:vlc 3.0.16
a=recvonly
a=type:broadcast
a=charset:UTF-8
a=control:rtsp://192.168.1.234:8554/stream1
m=video 0 RTP/AVP 96
b=RR:0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=J2QAKKwrQFAe0IAAAAMAgAAAHnJQABMSwAAvrze9wDxImoA=,KO4fLA==;
a=control:rtsp://192.168.1.234:8554/stream1/trackID=0
mpromonet commented 2 years ago

Hi @cedricve,

This is because your are capturing JPEG, the payload type 26. Your device should be able to capture H264 frame, then you will get an H264 stream with SPS & PPS.

Best Regards, Michel.

cedricve commented 2 years ago

Oh my god that explains it :) It’s indeed a USB camera, I was assuming to have your library doing internal encoding. My bad looks like it requires a passthrough with FFMPEG.

mpromonet commented 2 years ago

Hi,

The approach is lightweight, just capture frames from v4l2 interface and publish through RTSP, encoding can be done between the real device and a v4l2loopback one.

Best Regards, Michel.