This project has been forked from https://github.com/deepch/RTSPtoWSMP4f
This project converts the original code from deepch to provide a webservice for streaming fMP4 over HTTP rather than integrating the streams into a client via websockets.
The API allows a client to
- List available streams
- Connect to a stream
- Disconnect from a stream
When a client requests a stream connection, it passes a callback URL to which the server POSTs fMP4 data. The first connection to a stream launches the RTSP decoder and when no clients are connected the decoder stops. Each client has a MUXer to handle the repackaging of the video stream to fMP4.
-
Download source
git clone https://github.com/stuartcaunt/RTSPtoWSMP4f
-
CD to Directory
cd RTSPtoWSMP4f/
-
Run the server
GO111MODULE=on go run *.go
format:
{
"server": {
"http_port": ":8083"
},
"streams": {
"H264_AAC": {
"url": "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
}
}
}
The following assume the server is running on localhost on port 8083.
- Getting a list of streams
Endpoint:
GET /api/streams
curl -X GET http://localhost:8083/api/streams
- Connecting to a stream
Endpoint:
POST /api/streams/{streamId}/connect
curl -X POST http://localhost:8083/api/streams/Stream1/connect -d '{"url": "http://localhost:4000/api/streams"}'
Note: The server will POST video stream data to
http://localhost:8000/api/streams/Stream1
- Disconnecting from a stream
Endpoint:
POST /api/streams/{streamId}/disconnect
curl -X POST http://localhost:8083/api/streams/Stream1/disconnect -d '{"url": "http://localhost:4000/api/streams"}'
The project offers a simple node test client to test the reception of POSTed data
-
CD to Directory
cd demo-client
-
Install dependencies
npm install
-
Run the client application
npm start
By default the client runs on port 4000.
Video Codecs Supported: H264 all profiles, H265 work only safari and (IE hw video card)
Audio Codecs Supported: AAC
CPU usage 0.2% one core cpu intel core i7 / stream