grunt-ffmpeg
Grunt task to wrap ffmpeg using node-fluent-ffmpeg
Getting Started
You need FFmpeg >= 0.9 installed to work with this plugin. Read about it here
Install the plugin with:
npm install grunt-ffmpeg --save-dev
Documentation
Options
debug
Type: Boolien
Default: false
debug mode (now only for displaying ffmpeg command)
videoBitrate
Type: String
Default: undefined
Example: '1000k'
- 1000 kbps
Generated video bitrate
audioBitrate
Type: String
Default: undefined
Example: '64k'
- 64 kbps
Generated audio bitrate
size
Type: String
Default: undefined
(don't chage size)
Example: '800x600'
Generated video size WIDTH x HEIGHT
FFmpegOptions
Type: Object
Default: undefined
Example:
withAudioChannels: 1
Object of extra node-fluent-ffmpeg
options. Full list here
You can merge FFmpegOptions from options
and actual task config:
ffmpeg: options: FFmpegOptions: withVideoCodec: 'libx624' withAudioChannels: 2 compile: options: FFmpegOptions: withAudioChannels: 1 withAspectRatio: 133 files: ...
With this config compile
task will have this FFmpegOptions:
FFmpegOptions: withVideoCodec: 'libx624' // from options withAudioChannels: 1 // merge task.options with options withAspectRatio: 133 // from task.options
Options Events
onEnd (input, output)
Type: Function
Default: undefined
Args
input: String
input file name
ouptut: String
output file name
Triggers when single file decoding is finished
onError (error, input, output)
Type: Function
Default: undefined
Args
err: String
error message
input: String
input file name
ouptut: String
output file name
Triggers when single file decoding has an error
onCodecData(data, input)
Type: Function
Default: undefined
Args
data: Object
codec data object
input: String
input file name
Triggers on single file and give codec info object
Examples
Simple Video Example
Generate *.mp4
files from *.avi
and *.flv
source files
grunt; grunt;grunt;
Simple Audio Example
Generate *.ogg
and *.mp3
files from *.wav
source files
grunt; grunt;grunt;
Full Example
Generate *.ogg
and *.mp3
files from *.wav
source files
grunt;
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
2014-07-11 v0.1.4
- #1 Add feature to merge options.FFmpegOptions with task.options.FFmpegOptions
2014-05-01 v0.1.0
- init release
License
Copyright (c) 2014 Licensed under the MIT license.