在我的网站上,我有一个选项可以由用户上传视频文件。我想创建该视频的缩略图。我曾尝试在本地系统与一些编码它工作正常。我尝试了相同的代码来维护它不起作用。我检查了服务器中启用的ffmpeg,它被禁用。他们是否有其他选择在服务器中创建缩略图,而不启用ffmpeg?请帮我找到解决方案。从服务器的视频在php中创建缩略图图像
3
A
回答
1
如果你不想使用ffmpeg,你也可以使用mencoder作为替代。但最后你需要安装ffmpeg/mencoder,然后使用它来渲染缩略图,因为PHP没有内置的功能来处理视频。
如果你是一个共享的虚拟主机提供商,你可能想看看像zencoder服务,会为你生成转换后的视频,包括缩略图的流:
+0
他说的是准确的。 +1 – kingmaple 2012-04-20 06:12:01
2
可以使用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
实例
// 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);
想你也应该看看细节劝阻上可能存在的问题
相关问题
- 1. WCF服务创建视频缩略图
- 2. 从PHP文件,视频,图像创建缩略图
- 3. php创建服务器上的图像缩略图
- 4. ffmpeg-php创建视频缩略图
- 5. 从路径创建视频缩略图
- 6. 如何从服务器视频获取视频缩略图?
- 7. 在外部服务器上创建图像的缩略图
- 8. 从视频网址创建缩略图图像!
- 9. 从图库中挑选图像并在图像视图中创建缩略图
- 10. 如何创建嵌入视频代码的缩略图图像
- 11. 从视频网址获取视频的缩略图图像
- 12. ASP.Net:上传视频,创建缩略图
- 13. iPhone:创建视频缩略图
- 14. 创建HTML5视频缩略图
- 15. 生成视频的缩略图图像
- 16. 使用ffmpeg生成视频缩略图;从RTMP服务器
- 17. 从视频中生成缩略图的服务
- 18. 从图像创建视频
- 19. 从视频文件创建缩略图返回null位图
- 20. facebook视频缩略图图像网址?
- 21. 如何在视频上传时创建缩略图? [php/codeigniter]
- 22. 从asp.net中的视频创建缩略图
- 23. 视频缩略图
- 24. 如何发送视频缩略图到在线服务器
- 25. 什么是从PHP中的视频创建缩略图的更好方法?
- 26. 在SD卡中创建视频文件的缩略图
- 27. PHP的图像压缩和缩略图创建
- 28. 缩略图 - 创建本地设备或从服务器下载
- 29. 通过php在oracle中创建和插入图像缩略图
- 30. 从视频中提取缩略图图像 - jQuery插件?
我不能在我的本地''EXEC创建截图( “ffmpeg -i $ remoteVideo -ss 00:00:01.000 -vframes 1 $ destImagePath”);' – Hitesh 2014-11-28 10:42:01
可以看看我的问题吗?请http://stackoverflow.com/questions/27189948/ffmpeg-is-not -creating-screenshot-from-video – Hitesh 2014-11-28 13:52:04