README.md (2767B)
1 [![Logo](https://hydrabolt.me/assets/prism-media-logo.svg)](https://hydrabolt.me/prism-media/) 2 3 <div align="center"> 4 5 [![Build Status](https://travis-ci.org/amishshah/prism-media.svg?branch=master)](https://travis-ci.org/hydrabolt/prism-media) 6 [![dependencies](https://david-dm.org/amishshah/prism-media/status.svg)](https://david-dm.org/hydrabolt/prism-media) 7 [![npm](https://img.shields.io/npm/dt/prism-media.svg)](https://www.npmjs.com/package/prism-media) 8 [![Patreon](https://img.shields.io/badge/donate-patreon-F96854.svg)](https://www.patreon.com/discordjs) 9 10 </div> 11 12 ## What is it? 13 14 An easy-to-use stream-based toolkit that you can use for media processing. All the features provided have predictable 15 abstractions and join together coherently. 16 17 ```js 18 // This example will demux and decode an Opus-containing OGG file, and then write it to a file. 19 const prism = require('prism-media'); 20 const fs = require('fs'); 21 22 fs.createReadStream('./audio.ogg') 23 .pipe(new prism.opus.OggDemuxer()) 24 .pipe(new prism.opus.Decoder({ rate: 48000, channels: 2, frameSize: 960 })) 25 .pipe(fs.createWriteStream('./audio.pcm')); 26 ``` 27 28 The example above can work with either a native or pure JavaScript Opus decoder - you don't need to worry about changing 29 your code for whichever you install. 30 31 - FFmpeg support (either through npm modules or a normal installation) 32 - Opus support (native or pure JavaScript) 33 - Demuxing for WebM/OGG files (no modules required!) 34 - Volume Altering (no modules required!) 35 36 ## Dependencies 37 38 The following dependencies are all optional, and you should only install one from each category (the first listed in 39 each category is preferred) 40 41 - Opus 42 - [`@discordjs/opus`](https://github.com/discordjs/opus) 43 - [`node-opus`](https://github.com/Rantanen/node-opus) 44 - [`opusscript`](https://github.com/abalabahaha/opusscript) 45 - FFmpeg 46 - [`ffmpeg-static`](http://npmjs.com/ffmpeg-static) 47 - `ffmpeg` from a [normal installation](https://www.ffmpeg.org/download.html) 48 49 ## Useful Links 50 51 - [Documentation](https://hydrabolt.me/prism-media) 52 - [Examples](https://github.com/amishshah/prism-media/tree/master/examples) 53 - [Patreon](https://www.patreon.com/discordjs) 54 55 ## License 56 57 > Copyright 2019 - 2020 Amish Shah 58 > 59 > Licensed under the Apache License, Version 2.0 (the "License"); 60 > you may not use this file except in compliance with the License. 61 > You may obtain a copy of the License at 62 > 63 > http://www.apache.org/licenses/LICENSE-2.0 64 > 65 > Unless required by applicable law or agreed to in writing, software 66 > distributed under the License is distributed on an "AS IS" BASIS, 67 > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 68 > See the License for the specific language governing permissions and 69 > limitations under the License.