Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agustinsrg/webrtc-forwarder
Utility for webrtc-cdn to forward WebRTC to other protocol, like RTMP.
https://github.com/agustinsrg/webrtc-forwarder
Last synced: 24 days ago
JSON representation
Utility for webrtc-cdn to forward WebRTC to other protocol, like RTMP.
- Host: GitHub
- URL: https://github.com/agustinsrg/webrtc-forwarder
- Owner: AgustinSRG
- License: mit
- Created: 2022-07-15T08:52:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-03T11:49:09.000Z (over 1 year ago)
- Last Synced: 2024-04-28T03:31:05.916Z (8 months ago)
- Language: Go
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebRTC Forwarder
Utility for [webrtc-cdn](https://github.com/AgustinSRG/webrtc-cdn) to forward WebRTC to other protocol, like RTMP.
It uses [FFMpeg](https://ffmpeg.org/) for the protocol remuxing, and the [pion/webrtc](https://github.com/pion/webrtc) for WebRTC connectivity.
## Compilation
In order to install dependencies, type:
```
go get github.com/AgustinSRG/webrtc-forwarder
```To compile the code type:
```
go build
```The build command will create a binary in the currenct directory, called `webrtc-forwarder`, or `webrtc-forwarder.exe` if you are using Windows.
## Usage
You can use the program from the command line:
```
webrtc-forwarder [OPTIONS]
```### OPTIONS (Required)
Here is a list of the required options:
| Option | Description |
|---|---|
| `--input, -i ` | Sets the input URL. Example: `ws://localhost/stream-id` |
| `--video-port, -vp ` | Port to forward video RTP packets. |
| `--audio-port, -ap ` | Port to forward audio RTP packets. |
| `--sdp-file, -sdp ` | File to use to forward the stream. After the connection is stablished, you can use this file as an input of FFMPEG. |
| `--forward-mode, -fm ` | Forward mode, check the section below for mode details. |### Forward modes
The available forward modes are the following:
| Mode | Description |
|---|---|
| `TEST` | Just setups the SDP file and lets you test it by yourself. |
| `RTMP` | Forwards to RTMP using the envirinment variable `RTMP_FORWARD_URL`. Example: `rtmp://live.twitch.tv/app/$STREAM_KEY` |
| `CUSTOM` | Run a custom command to forward or process the stream. The command must be set in `CUSTOM_FORWARD_COMMAND` environment variable. |### OPTIONS (Optional)
Here is a list of the rest of the options:
| Option | Description |
|---|---|
| `--help, -h` | Shows the command line options |
| `--version, -v` | Shows the version |
| `--debug` | Enables debug mode (prints more messages) |
| `--ffmpeg-path ` | Sets the FFMpeg path. By default is `/usr/bin/ffmpeg`. You can also change it with the environment variable `FFMPEG_PATH` |
| `--auth, -a ` | Sets auth token for the source. |
| `--secret, -s ` | Provides secret to generate authentication tokens. |## WebRTC options
You can configure WebRTC configuration options with environment variables:
| Variable Name | Description |
|---|---|
| STUN_SERVER | STUN server URL. Example: `stun:stun.l.google.com:19302` |
| TURN_SERVER | TURN server URL. Set if the server is behind NAT. Example: `turn:turn.example.com:3478` |
| TURN_USERNAME | Username for the TURN server. |
| TURN_PASSWORD | Credential for the TURN server. |