-1

I am trying to read a video as a stream from firebase and compress it using ffmpeg an it is too much time for the job to complete such that my call breaks before its done and I am getting socket hangup error. I have tried to increase the timeout of the call to 540s but it is still not enought for the job to be done. The framework I am using is nestJs with react as front-end. This is a web-app and the feature I am working on is a video recording functionality.

Here is the code I am trying to run. The library I am using is "fluent-ffmpeg": "^2.1.2", and "ffmpeg": "^0.0.4",

const bucket = storage.bucket('my-bucket.appspot.com');
      const filePath = 'videos/video.mp4'; // Replace with the full path to your file
      const videoFile = bucket.file(filePath);
      const readStream = videoFile.createReadStream();
const ffmpegCommand = ffmpeg();
      ffmpegCommand.input(readStream);
      ffmpegCommand
        .outputOptions([
          '-preset ultrafast',
          '-c:v libx264',
          '-c:a aac',
          '-vf scale=640:480',
        ])
        .format('wav');
const outputStream = await ffmpegCommand.pipe();
Sheeraz
  • 1
  • 2

0 Answers0