Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions lib/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,10 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) {
var onlyDestinationFile = folder != undefined ? false : true;
// Building the value for return value. Check if the callback is not a function. In this case will created a new instance of the deferred class
var deferred = typeof callback != 'function' ? when.defer() : { promise : null };
// Deal with input paths that have spaces in them, by quoting them
for (i=0; i<inputs.length; i++) {
inputs[i] = '\'' + inputs[i] + '\'';
}

// Create a copy of the commands list
var finalCommands = ['ffmpeg -i']
.concat(inputs.map(utils.addQuotes).join(' -i '))
.concat(inputs.join(' -i '))
.concat(commands.join(' '))
.concat(filtersComlpex.length > 0 ? ['-filter_complex "'].concat(filtersComlpex.join(', ')).join('') + '"' : [])
.concat([output]);
Expand Down Expand Up @@ -632,6 +629,34 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) {
// Executing the commands list
return execCommand.call(this, callback);
}

/**
* trimming the silence part from mp3
*/
this.fnTrimmingSilenceFromMP3 = function (destionationFileName, callback) {
// Check if file already exists. In this case will remove it
if (fs.existsSync(destionationFileName))
fs.unlinkSync(destionationFileName);

// Building the final path
var destinationDirName = path.dirname(destionationFileName)
, destinationFileNameWE = path.basename(destionationFileName, path.extname(destionationFileName)) + '.mp3'
, finalPath = path.join(destinationDirName, destinationFileNameWE);


// Adding commands to the list
this.addCommand('-vn');
this.addCommand('-ar', 44100);
this.addCommand('-ac', 2);
this.addCommand('-ab', 192);
this.addCommand('-f', 'mp3');

// Add destination file path to the command list
setOutput(finalPath);

// Executing the commands list
return execCommand.call(this, callback);
}

/**
* Extract frame from video file
Expand Down
69 changes: 49 additions & 20 deletions node_modules/when/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"main": "./index.js",
"dependencies": {
"when" : ">= 0.0.1"
"when": ">= 0.0.1"
}
}