How to create thumbnails while uploading video


I don’t want to ask my users to upload thumbnails seperatly. Is there any way to create thumbnails automaticly out of video which is getting uploaded.

Asked on April 10, 2020 in PHP.
Add Comment
3 Answer(s)
Best answer

PHP alone can not do this. You need FFmpeg for achieving this.

you can download from the below link and try using it.

Answered on April 10, 2020.
Add Comment

Thank you for your reply, I am using digital ocean hosting for my application.

How to install this on my linux server and configure?

Answered on April 10, 2020.
Add Comment

You can install it by following below steps,

Start by updating the packages list:

sudo apt update

Next, install FFmpeg by typing the following command:

sudo apt install ffmpeg

To validate that the package is installed properly use the ffmpeg -version command which prints the FFmpeg version:

ffmpeg -version

The output should look something like this:

ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)

To print all available FFmpeg’s encoders and decoders type:

ffmpeg -encodersffmpeg -decoders

That’s it. FFmpeg 3.4.6  is now installed on your system, and you can start using it.


$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('/var/www/project/public/video/demo.mp4);


Answered on April 10, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.