Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caffco/get-audio-duration
Returns duration of an audio file via ffprobe
https://github.com/caffco/get-audio-duration
audio audio-duration ffprobe javascript typescript
Last synced: 6 days ago
JSON representation
Returns duration of an audio file via ffprobe
- Host: GitHub
- URL: https://github.com/caffco/get-audio-duration
- Owner: caffco
- License: mit
- Created: 2015-08-12T18:03:34.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T03:52:27.000Z (18 days ago)
- Last Synced: 2024-10-18T09:41:26.281Z (18 days ago)
- Topics: audio, audio-duration, ffprobe, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 10.4 MB
- Stars: 68
- Watchers: 4
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - get-audio-duration
README
# get-audio-duration
[![NPM version][npm-image]][npm-url]
![Build Status](https://github.com/caffco/get-audio-duration/workflows/test/badge.svg)
[![Maintainability](https://api.codeclimate.com/v1/badges/5033f5c3edd89b931e4a/maintainability)](https://codeclimate.com/github/caffco/get-audio-duration/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/5033f5c3edd89b931e4a/test_coverage)](https://codeclimate.com/github/caffco/get-audio-duration/test_coverage)
[![License][license-image]][license-url]
[![NPM bundle size (minified)][bundle-size-image]][npm-url]
[![Downloads][downloads-image]][downloads-url]Get the duration of audio files with `ffprobe`.
# Supported platforms
Currently this package only supports Linux, Windows 7+, and MacOS 10.9+. **This package does not work in the browser**, iOS or Android.
# Install
```bash
$ npm install --save get-audio-duration
```# Usage
```js
const { getAudioDurationInSeconds } = require('get-audio-duration')getAudioDurationInSeconds('audio.flac').then((duration) => {
console.log(duration)
})// If you need to customize the path to ffprobe...
getAudioDurationInSeconds('audio.flac', '/path/to/ffprobe').then((duration) => {
console.log(duration)
})
```[npm-image]: https://img.shields.io/npm/v/get-audio-duration.svg
[npm-url]: https://npmjs.org/package/get-audio-duration
[bundle-size-image]: https://img.shields.io/bundlephobia/min/get-audio-duration.svg
[license-image]: http://img.shields.io/npm/l/get-audio-duration.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/get-audio-duration.svg
[downloads-url]: https://npmjs.org/package/get-audio-duration