https://github.com/libersys/rtp-ogg-opus-examples
RTP Ogg/Opus Tools Examples
https://github.com/libersys/rtp-ogg-opus-examples
Last synced: 3 days ago
JSON representation
RTP Ogg/Opus Tools Examples
- Host: GitHub
- URL: https://github.com/libersys/rtp-ogg-opus-examples
- Owner: libersys
- License: mit
- Created: 2020-08-09T01:22:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-27T17:56:43.000Z (over 3 years ago)
- Last Synced: 2025-04-02T07:35:20.012Z (3 months ago)
- Language: JavaScript
- Size: 18.8 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# RTP Ogg/Opus Tools Examples
TypeScript examples for the [rtp-ogg-opus](https://github.com/libersys/rtp-ogg-opus.git) module.
## Installation
```
yarn install
yarn build
```## Usage
### Example #1
Shows how to send and receive Opus streams through RTP using **OggOpusToRtp** and **RtpOpusToPcm** transform stream classes from **rtp-ogg-opus**.
OpusPlayer class uses **OggOpusToRtp** to encode an opus audio stream into RTP packets. The opus encoded audio is read from a music file and send to port 4440. The OpusListener class listens on port 4440 and uses **RtpOpusToPcm** to decode the received RTP packets, convert them to Linear PCM and play them back using node-speaker.
```
yarn run example1
```### Example #2
Shows how to send and receive Linear PCM streams through RTP using **RtpEncoder** and **RtpDecoder** transform stream classes from **rtp-ogg-opus**.
Slin16Player class uses **RtpEncoder** to encode a PCM audio stream into RTP packets. The PCM encoded audio is read from a file and send to port 4440. The Slin16Listener class listens on port 4440 and uses **RtpDecoder** to decode the received RTP packets and play them back using node-speaker.
```
yarn run example2
```### Debugging
Set DEBUG environment variable to "rtp-ogg-opus" if you want to see what is going on.
On Windows
```
SET DEBUG=rtp-ogg-opus
```On Linux
```
export DEBUG=rtp-ogg-opus
```### Music examples from [Bensound.com](https://www.bensound.com)