Skip to content

Commit

Permalink
Profiles abstracted
Browse files Browse the repository at this point in the history
  • Loading branch information
debloper committed Sep 6, 2015
1 parent 0b47917 commit 7c58572
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
15 changes: 13 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
var avconv = require('avconv');
var avconv = require('avconv')
, profiles = require('./profiles');

module.exports = function (config, next) {
var params = [];

for (var i in config.inputs) {
params.push('-i', config.inputs[i])
}

params = params.concat(profiles[config.profile]);

params.push('-y', config.output);

module.exports = function (params, next) {
avconv(params);
if (next && (next instanceof Function)) next();
}
7 changes: 7 additions & 0 deletions src/profiles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
'audio-mix-ac3': [
'-f', 'ac3',
'-c:a', 'ac3',
'-filter_complex', 'amix=inputs=2:duration=longest'
]
}
16 changes: 8 additions & 8 deletions test/audio.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
var mix = require('../src/index');

var params = [
'-i', (__dirname + '/data/MayItBe.m4a'),
'-i', (__dirname + '/data/CouncilOfElrond.m4a'),
'-f', 'ac3',
'-c:a', 'ac3',
'-filter_complex', 'amix=inputs=2:duration=longest',
'-y', (__dirname + '/data/audioMix.ac3')
];
var params = {
inputs: [
(__dirname + '/data/MayItBe.m4a'),
(__dirname + '/data/CouncilOfElrond.m4a')
],
output: (__dirname + '/data/audioMix.ac3'),
profile: 'audio-mix-ac3'
}

mix(params);

0 comments on commit 7c58572

Please sign in to comment.