我制作了视频库。我想要像youtube一样的视频缩略图。我怎样才能在php上传时获得。
答案 0 :(得分:3)
答案 1 :(得分:3)
使用以下两行来使用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秒后从您的视频中捕获图像。
希望这有帮助。