Bad argument for fluent-ffmpeg video compression at ChildProcess.spawn()
I am using fluent-ffmpeg library in node.js in Firebase for compressing videos uploaded by users through an android app, but the following code yield an error :
ffmpeg(tempFilePath).videoBitrate('1000k', true)
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})
.save(compressedVideoFilePath);
The error is:
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:303:26)
at exports.spawn (child_process.js:370:9)
at /user_code/node_modules/fluent-ffmpeg/lib/processor.js:152:24
at FfmpegCommand.proto._getFfmpegPath (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/user_code/node_modules/fluent-ffmpeg/lib/processor.js:132:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10)
at /user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14
at nextTask (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5324:14)
at Object.waterfall (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5334:5)
The tempFilePath is from downloading the user uploaded file onto the temp folder of firebase (/tmp/test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
const tempFilePath = path.join(os.tmpdir(), filePath);
destBucket.file(filePath).download({
destination: tempFilePath // Download the file to destFilePath
}
While the compressedVideoFilePath is the destination I want the compressed file to be saved (/tmp/compressed-test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
var compressedVideoFilePath = path.join(path.dirname(tempFilePath),"compressed-" + path.basename(tempFilePath));
After the compressed file is saved, I would upload the file to firebase storage with (But probably this is not the place that caused the error):
destBucket.upload(compressedVideoFilePath, {
destination: 'compressed-' + path.basename(filePath),
metadata: metadata
})
I don't know how to fix it, any one knows why this keeps happening? Thanks. :)
node.js firebase ffmpeg video-processing fluent-ffmpeg
add a comment |
I am using fluent-ffmpeg library in node.js in Firebase for compressing videos uploaded by users through an android app, but the following code yield an error :
ffmpeg(tempFilePath).videoBitrate('1000k', true)
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})
.save(compressedVideoFilePath);
The error is:
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:303:26)
at exports.spawn (child_process.js:370:9)
at /user_code/node_modules/fluent-ffmpeg/lib/processor.js:152:24
at FfmpegCommand.proto._getFfmpegPath (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/user_code/node_modules/fluent-ffmpeg/lib/processor.js:132:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10)
at /user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14
at nextTask (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5324:14)
at Object.waterfall (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5334:5)
The tempFilePath is from downloading the user uploaded file onto the temp folder of firebase (/tmp/test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
const tempFilePath = path.join(os.tmpdir(), filePath);
destBucket.file(filePath).download({
destination: tempFilePath // Download the file to destFilePath
}
While the compressedVideoFilePath is the destination I want the compressed file to be saved (/tmp/compressed-test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
var compressedVideoFilePath = path.join(path.dirname(tempFilePath),"compressed-" + path.basename(tempFilePath));
After the compressed file is saved, I would upload the file to firebase storage with (But probably this is not the place that caused the error):
destBucket.upload(compressedVideoFilePath, {
destination: 'compressed-' + path.basename(filePath),
metadata: metadata
})
I don't know how to fix it, any one knows why this keeps happening? Thanks. :)
node.js firebase ffmpeg video-processing fluent-ffmpeg
add a comment |
I am using fluent-ffmpeg library in node.js in Firebase for compressing videos uploaded by users through an android app, but the following code yield an error :
ffmpeg(tempFilePath).videoBitrate('1000k', true)
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})
.save(compressedVideoFilePath);
The error is:
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:303:26)
at exports.spawn (child_process.js:370:9)
at /user_code/node_modules/fluent-ffmpeg/lib/processor.js:152:24
at FfmpegCommand.proto._getFfmpegPath (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/user_code/node_modules/fluent-ffmpeg/lib/processor.js:132:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10)
at /user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14
at nextTask (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5324:14)
at Object.waterfall (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5334:5)
The tempFilePath is from downloading the user uploaded file onto the temp folder of firebase (/tmp/test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
const tempFilePath = path.join(os.tmpdir(), filePath);
destBucket.file(filePath).download({
destination: tempFilePath // Download the file to destFilePath
}
While the compressedVideoFilePath is the destination I want the compressed file to be saved (/tmp/compressed-test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
var compressedVideoFilePath = path.join(path.dirname(tempFilePath),"compressed-" + path.basename(tempFilePath));
After the compressed file is saved, I would upload the file to firebase storage with (But probably this is not the place that caused the error):
destBucket.upload(compressedVideoFilePath, {
destination: 'compressed-' + path.basename(filePath),
metadata: metadata
})
I don't know how to fix it, any one knows why this keeps happening? Thanks. :)
node.js firebase ffmpeg video-processing fluent-ffmpeg
I am using fluent-ffmpeg library in node.js in Firebase for compressing videos uploaded by users through an android app, but the following code yield an error :
ffmpeg(tempFilePath).videoBitrate('1000k', true)
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})
.save(compressedVideoFilePath);
The error is:
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:303:26)
at exports.spawn (child_process.js:370:9)
at /user_code/node_modules/fluent-ffmpeg/lib/processor.js:152:24
at FfmpegCommand.proto._getFfmpegPath (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/user_code/node_modules/fluent-ffmpeg/lib/processor.js:132:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10)
at /user_code/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14
at nextTask (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5324:14)
at Object.waterfall (/user_code/node_modules/fluent-ffmpeg/node_modules/async/dist/async.js:5334:5)
The tempFilePath is from downloading the user uploaded file onto the temp folder of firebase (/tmp/test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
const tempFilePath = path.join(os.tmpdir(), filePath);
destBucket.file(filePath).download({
destination: tempFilePath // Download the file to destFilePath
}
While the compressedVideoFilePath is the destination I want the compressed file to be saved (/tmp/compressed-test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4):
var compressedVideoFilePath = path.join(path.dirname(tempFilePath),"compressed-" + path.basename(tempFilePath));
After the compressed file is saved, I would upload the file to firebase storage with (But probably this is not the place that caused the error):
destBucket.upload(compressedVideoFilePath, {
destination: 'compressed-' + path.basename(filePath),
metadata: metadata
})
I don't know how to fix it, any one knows why this keeps happening? Thanks. :)
node.js firebase ffmpeg video-processing fluent-ffmpeg
node.js firebase ffmpeg video-processing fluent-ffmpeg
asked Nov 22 '18 at 12:44
Just A Bad ProgrammerJust A Bad Programmer
416
416
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431333%2fbad-argument-for-fluent-ffmpeg-video-compression-at-childprocess-spawn%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431333%2fbad-argument-for-fluent-ffmpeg-video-compression-at-childprocess-spawn%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown