0

I am currently using firebase function to do video compression, the file is first downloaded from the firebase storage, then through fluent ffmpeg, compress the file. Then, the video is re-uploaded to the firebase storage. However, the firebase function console shows that there is a error in ffmpeg:

 An error occurred: ffmpeg exited with code 1: compressed-Scooter- One (Always Hardcore).mp3: Read-only file system

But the firebase storage rules is set to read and write:

 service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write;
    }
  }
}

My code: https://github.com/MobileProjectTPC/VideoCompressor/blob/master/functions/index.js

The upper part is my own code, while the lower part is the testing code from Can you call out to FFMPEG in a Firebase Cloud Function with some changes.

So, I don't understand why the ffmpeg function wasn't able to convert the file. Do any one know why this keeps happening and how to fix it?

Also, the output of the functions for my code is as follows: Output of my code

While their code is as follows: Output of their code

As you can see for my code, the error shows up after the output of function finished. While for their code, there isn't any error at all but no compressed file in firebase. Does this means the fluent-ffmpeg function wasn't even ran at all for their code?

Thank You.

Programmer
  • 151
  • 1
  • 12
  • 3
    Most likely the error is about the file system on which ffmpeg runs, and has nothing to do with permissions on Firebase Storage. But it's hard to say anything conclusive without seeing the minimal code with which to reproduce this problem. – Frank van Puffelen Nov 27 '18 at 14:45
  • 3
    Note that you can only write local files to /tmp and nowhere else in Cloud Functions. – Doug Stevenson Nov 27 '18 at 15:46
  • I am using my own code for the video compression. But, I also used the code from the post: https://stackoverflow.com/questions/42773497/can-you-call-out-to-ffmpeg-in-a-firebase-cloud-function/43970491#43970491 Both my code and their code have the same problem when I run it. Thanks – Programmer Nov 28 '18 at 07:20

0 Answers0