Using FFmpeg video upload is successful in the database, but the file is not found in the storage directory. I want to make a thumbnail of the video that has just been uploaded using FFmpeg in Laravel. When viewed in the database it has been uploaded, but when viewed in the Laravel storage directory the file does not exist. What is the solution?
$store = new Post();
$files = $request->file('file');
$ext = $files->getClientOriginalExtension();
if ($ext == 'mp4' || $ext == 'mkv' || $ext == 'webm') {
$ext = $request->file('file')->extension();
$final = 'video' . time() . '.' . $ext;
$request->file('file')->move(storage_path('app/public/uploads/video/'), $final);
$store->file = $final;
// For Thumbnail
$thumbnailName = 'thumbnail' . time() . '.jpg';
$thumbnailPath = storage_path('app/public/uploads/video/thumbnails/') . $thumbnailName;
$ffmpegCommand = "ffmpeg -i " . storage_path('app/public/uploads/video/') . $final . " -ss 00:00:01.00 -vframes 1 " . $thumbnailPath;
exec($ffmpegCommand);
$store->thumbnail = $thumbnailName;
}
I've looked and tried coding based on the latest documentation, but it still can't run.