Bad argument for fluent-ffmpeg video compression at ChildProcess.spawn()











up vote
0
down vote

favorite












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. :)










share|improve this question


























    up vote
    0
    down vote

    favorite












    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. :)










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      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. :)










      share|improve this question













      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 12:44









      Just A Bad Programmer

      125




      125





























          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',
          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
          });


          }
          });














          draft saved

          draft discarded


















          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






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks