Skip to content

Commit

Permalink
options added to the mergeToFile process with addOption are applied o…
Browse files Browse the repository at this point in the history
…n the intermediate files
  • Loading branch information
g10 committed Oct 19, 2013
1 parent fe2e162 commit d21a309
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
lib-cov
*.swp
.idea
*.iml
5 changes: 4 additions & 1 deletion lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ exports = module.exports = function Processor(command) {
'-i', _mergeSource,
'-qscale:v',1,
fname
].join(' ')
]
];

command[1] = self.options.additional.concat(command[1]).join(' ');

exec(command.join(' '),function(err, stdout, stderr) {
if(err)throw err;
_callback(fname);
Expand Down
Binary file added test/assets/testaudio-one.wav
Binary file not shown.
Binary file added test/assets/testaudio-three.wav
Binary file not shown.
Binary file added test/assets/testaudio-two.wav
Binary file not shown.
31 changes: 31 additions & 0 deletions test/processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,37 @@ describe('Processor', function() {
});
});

describe('mergeToFile', function() {

it('should merge multiple files', function(done) {
var testFile = path.join(__dirname, 'assets', 'testMergeAddOption.wav');
var srcFile = path.join(__dirname, 'assets', 'testaudio-one.wav');
var src1File = path.join(__dirname, 'assets', 'testaudio-two.wav');
var src2File = path.join(__dirname, 'assets', 'testaudio-three.wav');

new Ffmpeg({source: srcFile, nolog: true})
.mergeAdd(src1File)
.mergeAdd(src2File)
.mergeToFile(testFile, function(stdout, stderr, err) {
assert.ok(!err);
fs.exists(testFile, function(exist) {
exist.should.true;
// check filesize to make sure conversion actually worked
fs.stat(testFile, function(err, stats) {
assert.ok(!err && stats);
stats.size.should.above(0);
stats.isFile().should.true;
// unlink file
fs.unlinkSync(testFile);
done();
});
});
});

});

});

describe('writeToStream', function() {
it('should save the output file properly to disk using a stream', function(done) {
var testFile = path.join(__dirname, 'assets', 'testConvertToStream.flv');
Expand Down

0 comments on commit d21a309

Please sign in to comment.