Copy code The code is as follows:
//Get the thumbnail of the video file
function getVideoCover($file,$time,$ name) {
if(empty($time))$time = '1';//The first frame of the first second is intercepted by default
$strlen = strlen($file);
// $videoCover = substr($file,0,$strlen-4);
// $videoCoverName = $videoCover.'.jpg';//Thumbnail naming
//exec("ffmpeg -i ".$file ." -y -f mjpeg -ss ".$time." -t 0.001 -s 320x240 ".$name."",$out,$status);
$str = "ffmpeg -i ".$file ." -y -f mjpeg -ss 3 -t ".$time." -s 320x240 ".$name;
//echo $str."";
$result = system ($str);
}
//Get the total length and creation time of the video file
function getTime($file){
$vtime = exec("ffmpeg -i " .$file." 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//");//Total length
$ctime = date("Y-m-d H:i: s",filectime($file)); //Creation time
//$duration = explode(":",$time);
// $duration_in_seconds = $duration[0]*3600 + $duration [1]*60+ round($duration[2]);//Convert to seconds
return array('vtime'=>$vtime,
'ctime'=>$ctime
) ;
}
http://www.bkjia.com/PHPjc/764621.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764621.htmlTechArticleCopy the code The code is as follows: //Get the thumbnail of the video file function getVideoCover($file,$time,$name ) { if(empty($time))$time = '1';//The first frame of the first second is intercepted by default $strlen = strle...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn