# video-metadata-thumbnails

> Convenience method to get metadata and thumbnails of HTML5 video or audio(only metadata) Blob.

Latest version **1.0.22** (published 2021-01-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install video-metadata-thumbnails
pnpm add video-metadata-thumbnails
yarn add video-metadata-thumbnails
bun add video-metadata-thumbnails
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.22 |
| Published | 2021-01-29 |
| First published | 2020-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 176.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 87 |
| Author | wangweiwei |
| Maintainers | dengfengwang |
| Keywords | video, thumbnails, preview, metadata, blob, duration, 视频, 缩略图, 预览, 帧, 图片, 元数据 |

## Links

- npm: https://www.npmjs.com/package/video-metadata-thumbnails
- Repository: https://github.com/wangweiwei/video-metadata-thumbnails
- Homepage: https://github.com/wangweiwei/video-metadata-thumbnails#readme
- Issues: https://github.com/wangweiwei/video-metadata-thumbnails/issues
- npm.io page: https://npm.io/package/video-metadata-thumbnails

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

- 1.0.22 (latest) — 2021-01-29
- 1.0.21 — 2021-01-28
- 1.0.20 — 2021-01-06
- 1.0.19 — 2021-01-06
- 1.0.18 — 2020-06-11
- 1.0.17 — 2020-04-14
- 1.0.16 — 2020-04-14
- 1.0.15 — 2020-04-14
- 1.0.13 — 2020-03-21
- 1.0.12 — 2020-03-21
- 1.0.7 — 2020-03-16
- 1.0.6 — 2020-03-15
- 1.0.5 — 2020-03-15
- 1.0.3 — 2020-03-15
- 1.0.2 — 2020-03-15
- … 1 more at https://npm.io/package/video-metadata-thumbnails/versions

## README

<p align="center">
  <a href="https://www.ellow.cn/examples/video-metadata-thumbnails/index.html" target="_blank">
    <img width="160" src="https://raw.githubusercontent.com/wangweiwei/video-metadata-thumbnails/master/examples/video.png" alt="logo">
  </a>
</p>

<h2 align="center">Video Metadata & Thumbnails</h2>

<p align="center">
  <a href="https://npmjs.com/package/video-metadata-thumbnails" rel="nofollow">
    <img alt="Latest Version on NPM" src="https://img.shields.io/npm/v/video-metadata-thumbnails" style="max-width:100%;">
  </a>
  <a href="https://github.com/wangweiwei/video-metadata-thumbnails/issues">
    <img alt="Issue" src="https://img.shields.io/badge/-help--wanted-brightgreen" style="max-width:100%;">
  </a>
  <a href="https://github.com/wangweiwei/video-metadata-thumbnails/blob/master/LICENSE">
    <img alt="Software License" src="https://img.shields.io/npm/l/video-metadata-thumbnails" style="max-width:100%;">
  </a>
  <a href="https://github.com/wangweiwei/video-metadata-thumbnails">
    <img alt="Contributors Anon" src="https://img.shields.io/github/contributors-anon/wangweiwei/video-metadata-thumbnails" style="max-width:100%;">
  </a>
  <a href="https://github.com/wangweiwei/video-metadata-thumbnails">
    <img alt="Code Size" src="https://img.shields.io/github/languages/code-size/wangweiwei/video-metadata-thumbnails" style="max-width:100%;">
  </a>
  <a href="https://github.com/wangweiwei/video-metadata-thumbnails">
    <img alt="Languages Count" src="https://img.shields.io/github/languages/count/wangweiwei/video-metadata-thumbnails" style="max-width:100%;">
  </a>
  <br/>
  <a href="https://npmjs.com/package/video-metadata-thumbnails" >
    <img alt="Downloads" src="https://img.shields.io/npm/dt/video-metadata-thumbnails.svg" style="max-width:100%;">
  </a>
  <a href="https://github.com/wangweiwei/video-metadata-thumbnails">
    <img alt="Languages" src="https://img.shields.io/github/languages/top/wangweiwei/video-metadata-thumbnails" style="max-width:100%;">
  </a>
  <a href="https://www.ellow.cn/examples/video-metadata-thumbnails/index.html" rel="nofollow">
    <img alt="Examle Online" src="https://img.shields.io/badge/-Example--Online-blue" style="max-width:100%;">
  </a>
</p>

Convenience method(or Video object) to get metadata and thumbnails of HTML5 video Blob.

English | [简体中文](https://github.com/wangweiwei/video-metadata-thumbnails/blob/master/README.zh.md)

## Environment Support

- Microsoft Edge
- Google Chrome
- Safari(Not perfect)
    - need to wait for the video to finish playing
    - can't use all parameters
- Firfox(Not perfect)
    - need to wait for the video to finish playing
    - can't use all parameters
    
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br> Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox |
| --- | --- | --- | --- |
| last 2 versions | last 2 versions | last 2 versions | last 2 versions |

## **Installation**

```shell
npm install --save video-metadata-thumbnails
```

or

```
yarn add video-metadata-thumbnails
```

## **Usage**

### getMetadata method &  getThumbnails method

​	Add `video-metadata-thumbnails.iife.js` to your document and get the metadata or thumbnails value of the promise returned by `then`:

```html
<input type="file" onchange="onChange(this.files)" />
<script src="https://cdn.jsdelivr.net/npm/video-metadata-thumbnails/lib/video-metadata-thumbnails.iife.js"></script>
<script>
function onChange(files) {
  __video_metadata_thumbnails__.getMetadata(files[0]).then(function(metadata) {
    console.log('Metadata: ', metadata);
  })
  __video_metadata_thumbnails__.getThumbnails(files[0]).then(function(thumbnails) {
    console.log('Thumbnails: ', thumbnails);
  })
}
</script>
```

​	Alternatively, you can import(or require) `video-metadata-thumbnails` by getting it from `npm` :

```javascript
import { getMetadata, getThumbnails } from 'video-metadata-thumbnails';
  
const metadata = await getMetadata(blob);
const thumbnails = await getThumbnails(blob, {
  quality: 0.6
});
console.log('Metadata: ', metadata);
console.log('Thumbnails: ', thumbnails);
```
### Video Object

​	Import(or require) `video-metadata-thumbnails` by getting it from `npm`

```      javascript
import { Video } from 'video-metadata-thumbnails';

const video = new Video(blob);
console.log('Metadata:', await video.getMetadata());
console.log('Thumbnails:', await video.getThumbnails({
  quality: 0.6
}))
```

## **Thumbnails' Options**

* quality
  * type: number
  * default: 0.7
  * description: video thumbnails' quality
* interval
  * type: number
  * default: 1
  * description: time interval
* scale
  * type: number
  * default: 0.7
  * description: video thumbnails' scale
* start
  * type: number
  * default: 0
  * description: start frame
* end
  * type: number
  * default: 0
  * description: the end of frame

## **Example**

[![Example Online](https://img.shields.io/badge/-Example--Online-blue?style=for-the-badge&logo=internet-explorer)](https://www.ellow.cn/examples/video-metadata-thumbnails/index.html)

## **⚠️  Notice**

​	`Blob` object is required in browser.


## **License**
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/wangweiwei/video-metadata-thumbnails/blob/master/LICENSE)

Copyright (c) 2020-present, Weiwei Wang

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