fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Taking too much time to compress video

SheerazRasheed opened this issue · comments

Version information

  • fluent-ffmpeg version: ^2.1.2
  • ffmpeg version: ^0.0.4
  • OS: Ubuntu 22.04

Code to reproduce

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();

(note: if the problem only happens with some inputs, include a link to such an input file)

Observed results

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.

Maybe download the video file fully and then try to compress it?

Agreed with what's said above, that does not sound like a fluent-ffmpeg problem