From 8c44e1bf7b502a4a6ef20d65e4cbe1e717d595ff Mon Sep 17 00:00:00 2001 From: vvchens Date: Tue, 21 Apr 2020 22:12:53 -0400 Subject: [PATCH 1/5] Update video.js fix error when filepath contains special character --- lib/video.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/video.js b/lib/video.js index 903efdb..6dc12d7 100644 --- a/lib/video.js +++ b/lib/video.js @@ -45,7 +45,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Add an input stream */ this.addInput = function (argument) { - inputs.push(argument); + inputs.push(`"${argument}"`); } /** @@ -59,7 +59,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Set the output path */ var setOutput = function (path) { - output = path; + output = `"${path}"`; } /*********************/ @@ -455,7 +455,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { */ var resetCommands = function (self) { commands = new Array() - inputs = [self.file_path]; + inputs = [`"${self.file_path}"`]; filtersComlpex = new Array(); output = null; options = new Object(); From d3aa09480ff13190c12181956d006370eb8a14b1 Mon Sep 17 00:00:00 2001 From: vvchens Date: Sat, 23 May 2020 14:50:16 -0400 Subject: [PATCH 2/5] Update video.js fix ffmpeg video input path --- lib/video.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/video.js b/lib/video.js index 6dc12d7..7bbc78d 100644 --- a/lib/video.js +++ b/lib/video.js @@ -45,7 +45,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Add an input stream */ this.addInput = function (argument) { - inputs.push(`"${argument}"`); + inputs.push(argument); } /** @@ -455,7 +455,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { */ var resetCommands = function (self) { commands = new Array() - inputs = [`"${self.file_path}"`]; + inputs = [self.file_path]; filtersComlpex = new Array(); output = null; options = new Object(); From 127d1123c96ab0fea6d1906e0893d152397f461f Mon Sep 17 00:00:00 2001 From: vvchens Date: Sat, 23 May 2020 14:59:05 -0400 Subject: [PATCH 3/5] Update video.js fix ffmpeg video input path --- lib/video.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/video.js b/lib/video.js index 7bbc78d..73b141e 100644 --- a/lib/video.js +++ b/lib/video.js @@ -45,7 +45,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Add an input stream */ this.addInput = function (argument) { - inputs.push(argument); + inputs.push(`"${argument}"`); } /** @@ -455,7 +455,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { */ var resetCommands = function (self) { commands = new Array() - inputs = [self.file_path]; + inputs = [`"${self.file_path}"`]; filtersComlpex = new Array(); output = null; options = new Object(); @@ -551,13 +551,9 @@ 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 0 ? ['-filter_complex "'].concat(filtersComlpex.join(', ')).join('') + '"' : []) .concat([output]); From e70aa59f9400cc671e6aa73bca9f087b5ed07e08 Mon Sep 17 00:00:00 2001 From: vvchens Date: Tue, 14 Jul 2020 15:28:37 -0400 Subject: [PATCH 4/5] Update video.js --- lib/video.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/video.js b/lib/video.js index 73b141e..3af1334 100644 --- a/lib/video.js +++ b/lib/video.js @@ -45,7 +45,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Add an input stream */ this.addInput = function (argument) { - inputs.push(`"${argument}"`); + inputs.push(argument); } /** @@ -59,7 +59,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Set the output path */ var setOutput = function (path) { - output = `"${path}"`; + output = path; } /*********************/ @@ -455,7 +455,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { */ var resetCommands = function (self) { commands = new Array() - inputs = [`"${self.file_path}"`]; + inputs = [self.file_path]; filtersComlpex = new Array(); output = null; options = new Object(); @@ -541,7 +541,9 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { return { width : width, height : height, aspect : aspect }; } - + var encodeArguments = function(argu) { + return argu.replace(/"/g, '\"').replace(/ /g, '\ ').replace(/\(/g, '\(').replace(/\)/g, '\)'); + } /** * Executing the commands list */ @@ -553,10 +555,10 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { var deferred = typeof callback != 'function' ? when.defer() : { promise : null }; // Create a copy of the commands list var finalCommands = ['ffmpeg -i'] - .concat(inputs.join(' -i ')) + .concat(inputs.map(encodeArguments).join(' -i ')) .concat(commands.join(' ')) .concat(filtersComlpex.length > 0 ? ['-filter_complex "'].concat(filtersComlpex.join(', ')).join('') + '"' : []) - .concat([output]); + .concat([encodeArguments(output)]); // Reset commands resetCommands(this); // Execute the commands from the list @@ -619,7 +621,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { this.addCommand('-vn'); this.addCommand('-ar', 44100); this.addCommand('-ac', 2); - this.addCommand('-ab', 192); + this.addCommand('-ab', '192k'); this.addCommand('-f', 'mp3'); // Add destination file path to the command list From 9a870c93ff817078774523eda569fe03ecd6dd6a Mon Sep 17 00:00:00 2001 From: vvchens Date: Tue, 25 Aug 2020 11:14:48 -0400 Subject: [PATCH 5/5] Update video.js --- lib/video.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/video.js b/lib/video.js index 3af1334..d282381 100644 --- a/lib/video.js +++ b/lib/video.js @@ -45,7 +45,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Add an input stream */ this.addInput = function (argument) { - inputs.push(argument); + inputs.push(`"${argument.replace('"', '\\"')}"`); } /** @@ -59,7 +59,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { * Set the output path */ var setOutput = function (path) { - output = path; + output = `"${path.replace('"', '\\"')}"`; } /*********************/ @@ -455,7 +455,7 @@ module.exports = function (filePath, settings, infoConfiguration, infoFile) { */ var resetCommands = function (self) { commands = new Array() - inputs = [self.file_path]; + inputs = [`"${self.file_path.replace('"', '\\"')}"`]; filtersComlpex = new Array(); output = null; options = new Object();