Copy codeThe Code is as follows:
// Obtain 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 '; // name the thumbnail.
// 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. "</br> ";
$ Result = system ($ str );
}
// Obtain 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/, //"); // The 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
);
}