在php中的服务器视频中创建缩略图 [英] Create thumbnail image from video in server in php

查看:120
本文介绍了在php中的服务器视频中创建缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站上,我可以选择用户上传视频文件。因此,我想创建该视频的缩略图。我已经尝试在本地系统与一些编码它是正常工作。我尝试使用相同的编码来服务它不工作。我检查了在服务器启用的ffmpeg,它被禁用。是否有任何其他选项可以在启用ffmpeg的服务器中创建缩略图?请帮我找到解决方案。

In my website I have a option to upload video file by the user. In that I want to create a thumbnail image of that video. I have tried in local system with some coding it is working fine. I tried same coding in to service it is not working. I checked for ffmpeg enabled in server, it was disabled. Is their any other option to creating thumbnail in server with out enabling the ffmpeg? Please help me to find the solution.

推荐答案

你可以使用 ffmpeg (表单你标签我想你知道)

you can use ffmpeg ( Form you tag i guess you knew )

您需要传递给ffmpeg是

What you needed to pass to 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

示例

// 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);

或尝试

$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 detail dissuasion on possible issues

ffmpeg-php创建视频缩略图

这篇关于在php中的服务器视频中创建缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆