php获取视频封面图
[php]
function getVideoImages($file, $times = array(), $resolution = '640x360'){
	$result = array();  
	$pathParts = pathinfo($file);
	$filename = $pathParts['dirname']."/".$pathParts['filename']."_";  
	foreach ($times as $k => $v) {
		$destFilePath = $filename.$v.".jpg";
		$command = "/usr/bin/ffmpeg -i {$file} -y -f image2 -ss {$v} -vframes 1 -s {$resolution} {$destFilePath}";
		exec($command);
		//chmod($filename.$v."jpg",0644);
		$destUrlPath = str_replace(ROOT_PATH, "", $destFilePath);
		$selected = $k == 0 ? "1" : "0";//默认将第一张图片作为封面图
		array_push($result,array($destUrlPath,$selected));
	}
	return $result;
}
[/php]
阅读剩余
            版权声明:
作者:z1988
链接:https://www.z1988.com/1703.html
文章版权归作者所有,未经允许请勿转载。
            作者:z1988
链接:https://www.z1988.com/1703.html
文章版权归作者所有,未经允许请勿转载。
        THE END