Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

options added to the mergeToFile process with addOption are applied o…

…n the intermediate files
  • Loading branch information...
commit d21a309d3b608c7f2b0d363835d866efc5e6343d 1 parent fe2e162
@g10 g10 authored
View
1  .gitignore
@@ -3,3 +3,4 @@ node_modules
lib-cov
*.swp
.idea
+*.iml
View
5 lib/processor.js
@@ -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);
View
BIN  test/assets/testaudio-one.wav
Binary file not shown
View
BIN  test/assets/testaudio-three.wav
Binary file not shown
View
BIN  test/assets/testaudio-two.wav
Binary file not shown
View
31 test/processor.test.js
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.