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.7k stars 1.48k forks source link

Feature Request: Multicast RTP support for RTSP ANNOUNCE/RECORD #2347

Open BuzzyBee2023 opened 1 year ago

BuzzyBee2023 commented 1 year ago

Describe the feature

Description

Currently a user may use the RTSP ANNOUNCE and RECORD commands to publish RTP/TCP and RTP/UDP Unicast streams to MediaMtx. However, RTP/UDP Multicast streams are not supported. Attempts to publish such streams fail at the RTSP SETUP stage with the following message: 'RTSP/1.0 461 Unsupported Transport'. MediaMtx currently supports requesting RTP/UDP Multicast streams via the RTSP DESCRIBE and PLAY commands, so MediaMtx does already include support for such streams. I imagine that the lift to support this feature may be lite. I have an existing application that generates RTP/UDP Multicast Streams, and I would like to integrate the application with MediaMtx with the RTSP ANNOUNCE and RECORD commands. Thank you so much for your hard work and congratulations on creating such a wonderful product!

aler9 commented 1 year ago

Hello, you're right, publishing with RTSP and the UDP multicast transport protocol is currently unsupported, but the reason is that few people use this feature, because its only advantage is the ability to stream something to RTSP and RTP listeners at the same time. Usually people pick a single protocol (either RTSP/multicast or RTP/multicast) and use it in their entire infrastructure.

I'm leaving this feature request open in order to check whether there is interest in this feature.

BuzzyBee2023 commented 1 year ago

Thank you for your quick response. Would MediaMtx be open to code contributions for this feature? I would not want to work on it, if I did not think it would be integrated into a release version...

aler9 commented 1 year ago

Would MediaMtx be open to code contributions for this feature? I would not want to work on it, if I did not think it would be integrated into a release version...

Yes, absolutely! the RTSP implementation is located inside gortsplib, you can start by removing these lines:

https://github.com/bluenviron/gortsplib/blob/1b0ece827062579ac879fd03b2ab3ec4fd685285/server_session.go#L731-L735

rrajra commented 11 months ago

Thanks for your hard work on this project. Just commenting to show interest for this feature, it would help me a lot. I would attempt to make the change myself, but unfortunately have never worked with go before.

BuzzyBee2023 commented 11 months ago

@rrajra I have an application that currently streams out multicast packets, so I was hoping for ANNOUNCE/RECORD multicast support. Since that feature does not exist, I implemented ANNOUNCE/RECORD in Unicast RTP for my application. Although it adds an additional hop, it seems to work very well so far, so I do not have an immediate need to implement multicast support. I am sorry to disappoint you. If the need arises, perhaps I will revisit the feature in the future.