This is just a one liner as my class uses lots of method etc that you probably don’t need.

The money shot is this:


if (! file_exists ( $thumb_dir . $thumbname )) {
$draw_thumb = shell_exec ( $this->ffmpeg . ' -y -i ' . $video_file . ' -f image2 -ss 10 -vframes 1 -an ' . $thumb_dir . $thumbname );
}

($this->ffmpeg = the location of the ffmpeg binary)

This will generate a thumbnail of the video at 10 seconds.

Share/Save/Bookmark