# node-ffprobe

> NodeJS wrapper around ffprobe

Latest version **3.0.0** (published 2019-11-10) · 0 weekly downloads

## Install

```sh
npm install node-ffprobe
pnpm add node-ffprobe
yarn add node-ffprobe
bun add node-ffprobe
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2019-11-10 |
| First published | 2011-09-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 5.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 118 |
| Author | Thomas Quick |
| Maintainers | severeon |
| Keywords | ffprobe, id3 |

## Links

- npm: https://www.npmjs.com/package/node-ffprobe
- Repository: https://github.com/ListenerApproved/node-ffprobe
- Homepage: https://github.com/ListenerApproved/node-ffprobe#readme
- Issues: https://github.com/ListenerApproved/node-ffprobe/issues
- npm.io page: https://npm.io/package/node-ffprobe

## 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

- 3.0.0 (latest) — 2019-11-10
- 2.0.0 — 2019-10-14
- 1.2.2 — 2013-04-20
- 1.2.1 — 2012-12-07
- 1.2.0 — 2012-08-29
- 1.1.0 — 2012-06-19
- 1.0.6 — 2012-01-30
- 1.0.5 — 2011-10-06
- 1.0.4 — 2011-09-29
- 1.0.3 — 2011-09-29
- 1.0.2 — 2011-09-29
- 1.0.1 — 2011-09-29
- 1.0.0 — 2011-09-29

## README

# FFProbe for NodeJS

A simple sync wrapper around ffprobe written in NodeJS

***This module requires ffmpeg to be installed before it can function***.  The ffprobe utility comes bundled with ffmpeg.  If you just need this to work under multiple configs consider using `@ffprobe-installer/ffprobe` as detailed in the usage example below

## Installation

```sh
# regular NPM package install
npm install --save node-ffprobe

# install directly from GitHub
npm install --save github:ListenerApproved/node-ffprobe

# install NPM package via Yarn
yarn add node-ffprobe
```



## Run
 	$ npm i



## Usage

```js
const probe = require('node-ffprobe')
const ffprobeInstaller = require('@ffprobe-installer/ffprobe')

console.log(ffprobeInstaller.path, ffprobeInstaller.version)

ffprobe.FFPROBE_PATH = ffprobeInstaller.path

var track = '/path/to/media/file.mp3' // or video

probe(track).then(probeData => {
	console.log(probeData)
})
```

FFPROBE_PATH is useful if you embed the lib in your app.

Calling probe will execute ffprobe and parse the data it sends to STDOUT.  A sample object can be seen below.

Additionnally, you can set `ffprobe.SYNC` to `true` if you want for a particular reason to launch ffprobe synchronously (for example when used in batch processing of files to avoid too many spawns at once.)

The JSON returned by this utility is directly produced by ffprobe using the `-print_format json` flag


### Example Output


```js
{
   "programs": [],
   "streams": [
      {
         "index": 0,
         "codec_name": "mp3",
         "codec_long_name": "MP3 (MPEG audio layer 3)",
         "codec_type": "audio",
         "codec_time_base": "1/44100",
         "codec_tag_string": "[0][0][0][0]",
         "codec_tag": "0x0000",
         "sample_fmt": "fltp",
         "sample_rate": "44100",
         "channels": 2,
         "channel_layout": "stereo",
         "bits_per_sample": 0,
         "r_frame_rate": "0/0",
         "avg_frame_rate": "0/0",
         "time_base": "1/14112000",
         "start_pts": 353600,
         "start_time": "0.025057",
         "duration_ts": 1865687040,
         "duration": "132.205714",
         "bit_rate": "320000",
         "disposition": {
            "default": 0,
            "dub": 0,
            "original": 0,
            "comment": 0,
            "lyrics": 0,
            "karaoke": 0,
            "forced": 0,
            "hearing_impaired": 0,
            "visual_impaired": 0,
            "clean_effects": 0,
            "attached_pic": 0,
            "timed_thumbnails": 0
         },
         "tags": {
            "encoder": "LAME3.99r"
         }
      }
   ],
   "chapters": [],
   "format": {
      "filename": "/Users/im.a.little.teapot/Downloads/file_example_MP3_5MG.mp3",
      "nb_streams": 1,
      "nb_programs": 0,
      "format_name": "mp3",
      "format_long_name": "MP2/3 (MPEG audio layer 2/3)",
      "start_time": "0.025057",
      "duration": "132.205714",
      "size": "5289384",
      "bit_rate": "320069",
      "probe_score": 51,
      "tags": {
         "genre": "Cinematic",
         "album": "YouTube Audio Library",
         "title": "Impact Moderato",
         "artist": "Kevin MacLeod"
      }
   }
}
```


## Roadmap
* Timeouts for async invocation
* move package to unified nodejs ffmpeg library

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