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
11.9k stars 1.5k forks source link

Compatibility issues with OBS RTSP Server plugin #1029

Open Asherslab opened 2 years ago

Asherslab commented 2 years ago

Which version are you using?

v0.19.2

Which operating system are you using?

Describe the issue

After a few seconds of any RTSP source running the SDP starts returning much larger than expected from the server. the sprop-parameter-sets value becomes huge. Connecting to the original RTSP stream does not have this issue with the SDP, only the SDP from the proxy is too large.

This is a problem since both my clients that I need to use this with do not support large SDP files like this.

Describe how to replicate the issue

  1. Start the server with a proxy configured
  2. Use OBS with RTSP Server plugin to publish an RTSP stream
  3. Connect to proxy via RTSP client

Did you attach the server logs?

https://gist.github.com/Asherslab/17dea28f25bddc737bd39968f127ffdf

nguyenthaohut commented 2 years ago

I have same problem.

aler9 commented 2 years ago

Thanks for reporting this issue, turned out that the server wasn't able to parse the SDP of the stream since it wasn't able to correctly decode H264 NALUs generated by that specific server (RTSP Server Plugin for OBS Studio), as they were wrapped into the Annex-B format, that normally is not used in RTSP.

This is a non-standard behavior of some specific servers and cameras, that i wasn't aware of. Since it's impossible to change the behavior of cameras, rtsp-simple-server has been adapted to support it.

aler9 commented 2 years ago

Anyway, it's still not possible to convert a stream generated by OBS RTSP Server into HLS, since it uses DTS instead of PTS as timestamp into RTP packets:

https://github.com/iamscottxu/obs-rtspserver/blob/fd7b228d6b0832166e52c1e674021adb5eb82ecc/rtsp_output.cpp#L423

Timestamp must be PTS, not DTS, so the OBS plugin must be patched in order to change this.