上传时php中的视频缩略图 [英] thumbnail of video in php while uploading

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

问题描述

可能的重复:
如何为视频创建缩略图或预览?

我制作了视频库.我想要那个视频的缩略图,比如 youtube.在 php 中上传时我怎么能得到它.

I have made video gallery . i want thumbnail of that video like youtube. how can i get that while uploading in php.

推荐答案

使用下面两行代码使用 ffmpeg 从视频创建图像

Use below two lines for creating image from video using ffmpeg

$str_command= $ffmpeg  ." -i " . $image_source_path . $image_cmd .$dest_image_path;     
shell_exec($str_command);

请在下面找到变量说明:

Please find variable explanation at below:

$ffmpeg ="Document path to your ffmpeg";
$image_source_path = "Document path to your video"
$image_cmd = " -r 1 -ss 00:00:10 -t 00:00:01 -s ".ALL_PLACE_WIDTH."x".ALL_PLACE_HEIGHT."   -f image2 " ;
    Where ALL_PLACE_WIDTH ="width of the image you want"
    ALL_PLACE_HEIGHT ="heoght of the image you want"

$dest_image_path = "Document path to your image which is going to create"

这将在 10 秒后从您的视频中捕获图像.

This will capture image from your video after 10 second.

FFMPEG

希望这会有所帮助.

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

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