【发布时间】:2011-01-16 21:58:12
【问题描述】:
我制作了视频库。我想要那个视频的缩略图,比如 youtube。在 php 中上传时如何获得它。
【问题讨论】:
我制作了视频库。我想要那个视频的缩略图,比如 youtube。在 php 中上传时如何获得它。
【问题讨论】:
【讨论】:
使用以下两行来使用 ffmpeg 从视频创建图像
$str_command= $ffmpeg ." -i " . $image_source_path . $image_cmd .$dest_image_path;
shell_exec($str_command);
请在下面找到变量解释:
$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 秒后从您的视频中捕获图像。
希望这会有所帮助。
【讨论】: