Is there any way that I can speed up the ffmpeg processing time

Posted 4 months ago by StephRocks22

Hello, I am using ffmpeg to upload video files, I am noticing that its taking a long time to process the video. The video could just be 1.2mb or 5.3mb or 10mb and its still slow. Is there any way that I can speed up the process. I would greatly appreciate it if you could help me. My code is below.

$video=new Video;   
  $file = $request->file('file');   
 $fileName =uniqid().$file->getClientOriginalName();
 
 $request->file->move(public_path('/app'), $fileName);
            $name_file=uniqid().'video.mp4';
         $ffp=FFMpeg::fromDisk('local')
         ->open($fileName)
    ->addFilter(function ($filters) {
        $filters->resize(new \FFMpeg\Coordinate\Dimension(640, 480));
    })
    ->export()
    ->toDisk('s3')
    ->inFormat(new \FFMpeg\Format\Video\X264('libmp3lame'))
    ->save($name_file);
               $imageName = Storage::disk('s3')->url($name_file);


    $video->title=$imageName;
    $video->save();

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.