Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/native-bindings/ffmpeg


https://github.com/native-bindings/ffmpeg

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# node-ffmpeg

### Installation

```
yarn add node-ffmpeg
```

### Usage

```
import {
Codec,
CodecContext,
FormatContext,
constants,
Packet,
Frame,
getBytesPerSample,
CodecParameters,
Rational
} from 'node-ffmpeg';

const enc = Codec.findEncoder(constants.AV_CODEC_ID_OPUS);
console.log(enc);

const encCtx = new CodecContext(enc);
encCtx.parametersToContext(new CodecParameters({
codecId: constants.AV_CODEC_ID_OPUS,
channels: 1,
channelLayout: constants.AV_CH_LAYOUT_MONO,
sampleRate: 48000,
bitRate: 20000,
codecType: constants.AVMEDIA_TYPE_AUDIO,
format: sampleFormat
}));
encCtx.open(enc);

console.log(encCtx.frameSize() === 960)
```