在我的网站中,我可以选择由用户上传视频文件。我想创建该视频的缩略图。我已经在本地系统中尝试过一些编码,它工作正常。我尝试使用相同的编码来提供服务,但它不起作用。我检查了服务器中是否启用了 ffmpeg,它已被禁用。他们是否还有其他选项可以在不启用 ffmpeg 的情况下在服务器中创建缩略图?请帮助我找到解决方案。
您可以使用ffmpeg
(形成你的标签我想你知道)
您需要传递给 ffmpeg 的是
-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);
认为您还应该对可能出现的问题进行详细劝阻
ffmpeg-php 创建视频缩略图 https://stackoverflow.com/questions/3911797/ffmpeg-php-to-create-thumbnail-of-video-problem
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)