HTTP and RTMP Multiplexed Server
Example is showing how its possible to run HTTP and RTMP server on same port.
Useful when we are limited to run our service on single port.
That example would not be possible without two awesome libraries;
- cmux - connection multiplexer for Go
- joy4 - audio/video library and streaming server for Go
Running Server
go get -u -v github.com/jkuri/http-rtmp-multiplex-server
cd $GOPATH/src/github.com/jkuri/http-rtmp-multiplex-server
dep ensure
go run main.go
Server will start on port 8300
.
Example Usage
First run the server, then
ffmpeg -re -i movie.flv -c copy -f flv rtmp://localhost:8300/movie # stream movie from file
ffmpeg -f avfoundation -i "0:0" .... -f flv rtmp://localhost:8300/screen # stream screen in MacOS
Play the live stream:
mpv http://localhost:8300/movie # play movie
ffplay http://localhost:8300/screen # play screen
License
MIT