https://github.com/native-bindings/ffmpeg
https://github.com/native-bindings/ffmpeg
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/native-bindings/ffmpeg
- Owner: native-bindings
- License: mit
- Created: 2021-09-02T03:06:40.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-02T03:12:10.000Z (almost 5 years ago)
- Last Synced: 2026-04-07T16:05:12.882Z (2 months ago)
- Language: C++
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
```