# simplemedia

> Node.js simple ffmpeg wrapper

Latest version **0.3.17** (published 2020-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install simplemedia
pnpm add simplemedia
yarn add simplemedia
bun add simplemedia
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.17 |
| Published | 2020-03-23 |
| First published | 2020-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 222.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 3 |
| Author | Bryce Ghim |
| Maintainers | buttonfly |
| Keywords | ffmpeg, video, audio, image, media |

## Links

- npm: https://www.npmjs.com/package/simplemedia
- Repository: https://github.com/gurumian/simplemedia
- Issues: https://github.com/gurumian/simplemedia/issues
- npm.io page: https://npm.io/package/simplemedia

## Dependencies (2)

- [bindings](https://npm.io/package/bindings.md) ~1.2.1
- [node-addon-api](https://npm.io/package/node-addon-api.md) ^1.7.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.3.17 (latest) — 2020-03-23
- 0.3.16 — 2020-03-19
- 0.3.14 — 2020-03-18
- 0.3.13 — 2020-03-17
- 0.3.11 — 2020-03-17
- 0.3.10 — 2020-03-16
- 0.3.9 — 2020-03-16
- 0.3.8 — 2020-03-16
- 0.3.5 — 2020-03-13
- 0.3.4 — 2020-03-13
- 0.3.3 — 2020-03-13
- 0.3.2 — 2020-03-13
- 0.3.1 — 2020-03-12
- 0.3.0 — 2020-03-12
- 0.2.14 — 2020-03-11
- … 30 more at https://npm.io/package/simplemedia/versions

## README

![Node.js CI](https://github.com/gurumian/simplemedia/workflows/Node.js%20CI/badge.svg)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgurumian%2Fsimplemedia.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgurumian%2Fsimplemedia?ref=badge_shield)


## Prerequisites
on Ubuntu
```bash
apt install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libsdl2-dev

```
on macOS
```bash
brew install ffmpeg sdl2
```


You may need to install `cmake-js` and `typescript`
```
npm i -g cmake-js
npm i -g typescript
```


## Install
```bash
npm i simplemedia
```

## Example
See `example/`

```js
const {Window, MediaPlayer} = require('simplemedia');


let window = new Window({
  title: "simplemedia nodejs",
  width: 640,
  height: 480,
});
let renderer = window.createRenderer();

let player = new MediaPlayer({
  renderer: renderer,
  trace: true,
});
player.datasource = media_uri;
player.prepare().then(resolve => {
  console.log('duration: ' + player.duration);
  player.start();
}).catch(err => {
  console.log(err);
});

player.onend = (() => {
  console.log('end-of-stream!');
});

readAndDispatch();
```


## (Optional) Native only build
```bash
cd native;
mkdir build; cd build
cmake .. && make
```
You'll probably get a binary named `mediaplayer`
try to run it with a media file
```bash
./mediaplayer /path/to/file
```


## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgurumian%2Fsimplemedia.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgurumian%2Fsimplemedia?ref=badge_large)

---
_Source: https://npm.io/package/simplemedia · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
