Skip to content

Commit

Permalink
update README, add instructions on how to run from docker
Browse files Browse the repository at this point in the history
  • Loading branch information
iSchluff committed Aug 8, 2021
1 parent c2e7047 commit fc25214
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 18 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ Streaming-Relay for the SRT-protocol

Use at your own risk

## Dependencies
Requires libsrt-1.4.2
## Build with docker
You will need atleast docker-20.10

```
docker build -t srtrelay .
```

## Build manually
### Install Dependencies
Requires >=libsrt-1.4.2, golang and a C compiler

**Ubuntu**
- you will need to [build libsrt yourself](https://github.com/Haivision/srt#build-on-linux)
Expand All @@ -16,16 +24,18 @@ Requires libsrt-1.4.2
**Gentoo**:
- emerge net-libs/srt

## Build
### Build
```
go build
go build -o srtrelay
```

## Usage
```bash
# start relay
# start relay (built manually)
./srtrelay



# start publisher
ffmpeg -i test.mp4 -c copy -f mpegts srt://localhost:1337?streamid=publish/test

Expand All @@ -48,7 +58,7 @@ The configuration file can be placed under *config.toml* in the current working
See [docs/API.md](docs/API.md) for more information about the API.

## Contributing
See [docts/Contributing.md](docs/Contributing.md)
See [docs/Contributing.md](docs/Contributing.md)

## Credits
Thanks go to
Expand Down
99 changes: 94 additions & 5 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,102 @@
See [config.toml.example](../config.toml.example) for configuring the API endpoint.

## Stream status - /streams
Returns a list of active streams with additional statistics.

Content-Type: application/json

Example:
- Returns a list of active streams with additional statistics.
- Content-Type: application/json
- Example:
```
GET http://localhost:8080/streams
[{"name":"abc","clients":0,"created":"2020-11-24T23:55:27.265206348+01:00"}]
```

## Socket statistics - /sockets
- Returns internal srt statistics for each SRT client
- the exact statistics might change depending over time
- this will show stats for both publishers and subscribers
- Content-Type: application/json
- Example:
```json
[
{
"address": "127.0.0.1:59565",
"stream_id": "publish/q2",
"stats": {
"MsTimeStamp": 26686,
"PktSentTotal": 0,
"PktRecvTotal": 9484,
"PktSndLossTotal": 0,
"PktRcvLossTotal": 0,
"PktRetransTotal": 0,
"PktSentACKTotal": 1680,
"PktRecvACKTotal": 0,
"PktSentNAKTotal": 0,
"PktRecvNAKTotal": 0,
"UsSndDurationTotal": 0,
"PktSndDropTotal": 0,
"PktRcvDropTotal": 0,
"PktRcvUndecryptTotal": 0,
"ByteSentTotal": 0,
"ByteRecvTotal": 11866496,
"ByteRcvLossTotal": 0,
"ByteRetransTotal": 0,
"ByteSndDropTotal": 0,
"ByteRcvDropTotal": 0,
"ByteRcvUndecryptTotal": 0,
"PktSent": 0,
"PktRecv": 9484,
"PktSndLoss": 0,
"PktRcvLoss": 0,
"PktRetrans": 0,
"PktRcvRetrans": 0,
"PktSentACK": 1680,
"PktRecvACK": 0,
"PktSentNAK": 0,
"PktRecvNAK": 0,
"MbpsSendRate": 0,
"MbpsRecvRate": 3.557279995149639,
"UsSndDuration": 0,
"PktReorderDistance": 0,
"PktRcvAvgBelatedTime": 0,
"PktRcvBelated": 0,
"PktSndDrop": 0,
"PktRcvDrop": 0,
"PktRcvUndecrypt": 0,
"ByteSent": 0,
"ByteRecv": 11866496,
"ByteRcvLoss": 0,
"ByteRetrans": 0,
"ByteSndDrop": 0,
"ByteRcvDrop": 0,
"ByteRcvUndecrypt": 0,
"UsPktSndPeriod": 10,
"PktFlowWindow": 8192,
"PktCongestionWindow": 8192,
"PktFlightSize": 0,
"MsRTT": 0.013,
"MbpsBandwidth": 1843.584,
"ByteAvailSndBuf": 12288000,
"ByteAvailRcvBuf": 12160500,
"MbpsMaxBW": 1000,
"ByteMSS": 1500,
"PktSndBuf": 0,
"ByteSndBuf": 0,
"MsSndBuf": 0,
"MsSndTsbPdDelay": 200,
"PktRcvBuf": 74,
"ByteRcvBuf": 89851,
"MsRcvBuf": 188,
"MsRcvTsbPdDelay": 200,
"PktSndFilterExtraTotal": 0,
"PktRcvFilterExtraTotal": 0,
"PktRcvFilterSupplyTotal": 0,
"PktRcvFilterLossTotal": 0,
"PktSndFilterExtra": 0,
"PktRcvFilterExtra": 0,
"PktRcvFilterSupply": 0,
"PktRcvFilterLoss": 0,
"PktReorderTolerance": 0
}
}
]
```
10 changes: 3 additions & 7 deletions docs/Contributing.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Contributing
Run tests before creating a pull request
Please run tests before creating a pull request
```
go test ./...
```

## General concepts
- Just a 1:n multiplexer, one publisher (push) to multiple subscribers (pull)
- srtrelay hsould just be a 1:n multiplexer, one publisher (push) to multiple subscribers (pull)
- Don't try to reimplement functionality already present elsewhere in the stack (e.g. remuxing/transcoding)
- Allow any data to be relayed, not just MPEG-TS

## TODOs
### Figure out what's going on with ffmpeg srt support
If an srt stream is read with ffmpeg (atleast for h.264 + MPEG-TS)
- Allow any data to be relayed, not just MPEG-TS

0 comments on commit fc25214

Please sign in to comment.