Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/transitive-bullshit/ffmpeg-on-progress
Utility for robustly reporting progress with fluent-ffmpeg.
https://github.com/transitive-bullshit/ffmpeg-on-progress
ffmpeg fluent-ffmpeg
Last synced: 2 months ago
JSON representation
Utility for robustly reporting progress with fluent-ffmpeg.
- Host: GitHub
- URL: https://github.com/transitive-bullshit/ffmpeg-on-progress
- Owner: transitive-bullshit
- Created: 2018-03-28T05:55:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-11T23:13:02.000Z (over 4 years ago)
- Last Synced: 2024-11-02T06:31:28.332Z (2 months ago)
- Topics: ffmpeg, fluent-ffmpeg
- Language: JavaScript
- Size: 296 KB
- Stars: 14
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-ffmpeg - ffmpeg-on-progress - Utility for robustly reporting progress with fluent-ffmpeg. (JavaScript)
README
# ffmpeg-on-progress
> Utility for robustly reporting ffmpeg command progress with fluent-ffmpeg.
[![NPM](https://img.shields.io/npm/v/ffmpeg-on-progress.svg)](https://www.npmjs.com/package/ffmpeg-on-progress) [![Build Status](https://travis-ci.com/transitive-bullshit/ffmpeg-on-progress.svg?branch=master)](https://travis-ci.com/transitive-bullshit/ffmpeg-on-progress) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
Some ffmpeg commands aren't capable fo producing [progress](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#progress-transcoding-progress-information) events, such as when the input is a stream or when using multiple inputs. This simple utility allows you to accurately report progress in these cases by looking at the number of frames ffmpeg has processed with the caveat that you need to know the expected output's duration ahead of time.
In cases where [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) produces a valid progress event, this module is a noop.
## Install
```bash
npm install --save ffmpeg-on-progress
# or
yarn add ffmpeg-on-progress
```## Usage
```js
const ffmpeg = require('fluent-ffmpeg')
const ffmpegOnProgress = require('ffmpeg-on-progress')const logProgress = (progress, event) => {
// progress is a floating point number from 0 to 1
console.log('progress', (progress * 100).toFixed())
}// estimated duration of output in milliseconds
const durationEstimate = 4000const cmd = ffmpeg('input.avi')
.output('output.mp4')
.on('progress', ffmpegOnProgress(logProgress, durationEstimate))
.run()
```## Related
- [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg)
- [awesome-ffmpeg](https://github.com/transitive-bullshit/awesome-ffmpeg) - A curated list of awesome ffmpeg resources with a focus on JavaScript.## License
MIT © [Travis Fischer](https://github.com/transitive-bullshit)
Support my OSS work by following me on twitter