When I upload video which size is more than 10 mb with laravel+vue3+mysql then it will be take a more time. I want to reduce a time to complete this task. what to do?
This is my controller side code to upload video with generate thumbnail and compress video.
public function sendMessage(Request $req)
{
if($req->hasFile('video'))
{
$files = $req->file('video');
foreach ($files as $key => $value) {
$fileName = md5(time()) . '_files_' . str_replace(" ", "_", $value->getClientOriginalName());
$explodeName = explode(".",$value->getClientOriginalName());
// image url
$url = 'chat_media_files_' . $value->getClientOriginalName();
$thumbnail = 'thumbnail_'.$value->getClientOriginalExtension().".png";
$lowBitrate = (new X264())->setKiloBitrate(100);
FFMpeg::open($value)
->export()
->toDisk('chat_media')
->inFormat($lowBitrate)
->save($url);
FFMpeg::fromDisk('chat_media')
->open($value)
->getFrameFromSeconds(5)
->export()
->toDisk('video_thumbnail')
->save($thumbnail);
}
}
return true;
}else{
return false;
}