config->getFfmpegBinary(), '-hide_banner', '-loglevel', 'error', '-ss', '1', '-i', $videoFile, '-frames:v', '1', '-q:v', '2', '-y', $coverFile, ]); $process->setTimeout(60); try { $process->run(); } catch (\Throwable $e) { throw new LocalizedException(__('Unable to run ffmpeg: %1', $e->getMessage())); } if (!$process->isSuccessful() || !is_file($coverFile) || filesize($coverFile) === 0) { throw new LocalizedException( __('ffmpeg failed to create the cover image: %1', trim($process->getErrorOutput()) ?: __('unknown error')) ); } } }