voc / srtrelay

SRT relay server for distributing media streams to multiple clients.
MIT License
144 stars 36 forks source link

Renaming StreamIDs on the fly (another nginx-RTMP feature) #9

Closed ravenium closed 3 years ago

ravenium commented 3 years ago

This was recently pointed out to me as A Thing, but it might only natively be an RTMP Thing. :)

Apparently it's possible to 302 redirect RTMP streams to a new stream name in nginx-rtmp, for example, if you connect as /live/mystream, nginx-rtmp redirects you to /live/mystream_12345 for publishing. This in effect lets you publish multiple times with the same stream name as it renames itself to avoid namespace collisions:

https://stackoverflow.com/questions/43568168/how-to-change-nginx-rtmp-stream-name-after-call-on-publish

Any idea if this could be implemented in SRT? It wouldn't be hard to generate a new StreamID on the fly, but my understanding of the SRT SDK seems to suggest that StreamID is embedded into the publish stream and is immutable on the protocol level.

iSchluff commented 3 years ago

Yeah I believe this is not possible on a protocol-level. But I think it could be done by doing the redirection internally, however that would add quite a bit of complexity.

ravenium commented 3 years ago

Probably not worth the trouble, all things considered - my streaming group has a Django based setup that records keys/streams and lets one person repeatedly stream with the same id (which then 302s to make it unique). It's very RTMP-centric and likely needs to change anyhow. :)