Create thumbnail from video on server in php

On my website, I have the option to upload a video file by a user. In this I want to create a thumbnail of this video. I tried on the local system with some coding, it works fine. I tried the same coding for maintenance, it does not work. I checked if ffmpeg is enabled on the server, it was disabled. Is their another option for creating thumbnails on a server without ffmpeg capability? Please help me find a solution.

+3
source share
2 answers

you can use ffmpeg(tag form i think you knew)

What you needed to pass ffmpeg is

-i = input file
-deinterlace = deinterlace pictures
-an = disable audio recording
-ss = start time in the video (seconds)
-t = duration of the recording (seconds)
-r = set frame rate
-y = overwrite existing file
-s = resolution size
-f = force format

Example

// where ffmpeg is located  
$ffmpeg = '/usr/bin/ffmpeg';  
//video dir  
$video = 'path/to/video';  
//where to save the image  
$image = 'path/to/image.jpg';  
//time to take screenshot at  
$interval = 5;  
//screenshot size  
$size = '640x480';  
//ffmpeg command  
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";

exec($cmd);

Or try

$second = 15;
$cmd = "$ffmpeg  -itsoffset -$second  -i $video -vcodec mjpeg -vframes 1 -an -f rawvideo -s $size $image";
exec($cmd);

Think you should also look at a detailed belief in possible problems.

ffmpeg-php

+3

ffmpeg, mencoder. ffmpeg/mencoder, , PHP .

-, , zencoder, , :

https://app.zencoder.com/docs/api/encoding/thumbnails

+1

All Articles