diff --git a/README.md b/README.md index f51bf1ef..ad494a62 100644 --- a/README.md +++ b/README.md @@ -515,7 +515,7 @@ vlc --rtsp-tcp rtsp://localhost:8554/mystream The RTSP protocol supports the UDP-multicast transport protocol, that allows a server to send packets once, regardless of the number of connected readers, saving bandwidth. -This mode must be requested by readers when handshaking with the server; once a reader has completed a handshake, the server will start sending multicast packets. Other readers will be instructed to pull the stream from the existing multicast packets. When all multicast readers have disconnected from the server, the latter will stop sending multicast packets. +This mode must be requested by readers when handshaking with the server; once a reader has completed a handshake, the server will start sending multicast packets. Other readers will be instructed to read existing multicast packets. When all multicast readers have disconnected from the server, the latter will stop sending multicast packets. To request and read a stream with UDP-multicast, you can use _FFmpeg_: @@ -529,7 +529,11 @@ or _GStreamer_: gst-launch-1.0 rtspsrc protocols=udp-mcast location=rtsps://ip:8555/... ``` -At the moment _VLC_ doesn't support the UDP-multicast transport protocol. A workaround consists in launching an instance of _rtsp-simple-server_ on the same machine in which _VLC_ is running, using it for reading the stream with the proxy mode and UDP-multicast, and reading the proxied stream with _VLC_. +or _VLC_ (append `?vlcmulticast` to the URL): + +``` +vlc rtsp://localhost:8554/mystream?vlcmulticast +``` ### Encryption diff --git a/go.mod b/go.mod index fa42bb43..e41e47c1 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aler9/rtsp-simple-server go 1.17 require ( - github.com/aler9/gortsplib v0.0.0-20211113091354-ba7f9aff25cd + github.com/aler9/gortsplib v0.0.0-20211115164017-1411cb33f558 github.com/asticode/go-astits v1.10.0 github.com/fsnotify/fsnotify v1.4.9 github.com/gin-gonic/gin v1.7.2 diff --git a/go.sum b/go.sum index 26562bdd..8c6e4068 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/aler9/gortsplib v0.0.0-20211113091354-ba7f9aff25cd h1:/KEW7zhxd13haoMYkL5g1gOQTGUb+chRaqWkIx+BV6Y= -github.com/aler9/gortsplib v0.0.0-20211113091354-ba7f9aff25cd/go.mod h1:fyQrQyHo8QvdR/h357tkv1g36VesZlzEPsdAu2VrHHc= +github.com/aler9/gortsplib v0.0.0-20211115164017-1411cb33f558 h1:uyW1alIzoJCAmNZ2xuo5EOTbSbf9W7tVYOzb0UrzZ0U= +github.com/aler9/gortsplib v0.0.0-20211115164017-1411cb33f558/go.mod h1:fyQrQyHo8QvdR/h357tkv1g36VesZlzEPsdAu2VrHHc= github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927 h1:95mXJ5fUCYpBRdSOnLAQAdJHHKxxxJrVCiaqDi965YQ= github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927/go.mod h1:vzuE21rowz+lT1NGsWbreIvYulgBpCGnQyeTyFblUHc= github.com/asticode/go-astikit v0.20.0 h1:+7N+J4E4lWx2QOkRdOf6DafWJMv6O4RRfgClwQokrH8= diff --git a/internal/core/rtsp_server_test.go b/internal/core/rtsp_server_test.go index 66c280b8..34ec8ebc 100644 --- a/internal/core/rtsp_server_test.go +++ b/internal/core/rtsp_server_test.go @@ -23,6 +23,7 @@ func TestRTSPServerPublishRead(t *testing.T) { {"ffmpeg", "udp", "gstreamer", "multicast"}, {"ffmpeg", "udp", "gstreamer", "tcp"}, {"ffmpeg", "udp", "vlc", "udp"}, + {"ffmpeg", "udp", "vlc", "multicast"}, {"ffmpeg", "udp", "vlc", "tcp"}, {"ffmpeg", "tcp", "ffmpeg", "udp"}, {"gstreamer", "udp", "ffmpeg", "udp"}, @@ -177,7 +178,13 @@ func TestRTSPServerPublishRead(t *testing.T) { if ca.readerProto == "tcp" { args = append(args, "--rtsp-tcp") } - args = append(args, proto+"://localhost:"+port+"/teststream") + + ur := proto + "://localhost:" + port + "/teststream" + if ca.readerProto == "multicast" { + ur += "?vlcmulticast" + } + + args = append(args, ur) cnt2, err := newContainer("vlc", "dest", args) require.NoError(t, err) defer cnt2.close()