sudo apt-get install php5-ffmpeg
function movie_progress($video,$screens_path = FALSE,$screens_count = 10) { $movie = new ffmpeg_movie($video); if ( ! $movie) { return; } $frame_count = $movie->getFrameCount(); // $screens = FALSE; if ($screens_path) { // , $step = floor($frame_count / ($screens_count)); $screens = array(); // , for ($i = $step; $i < $frame_count; $i += $step) { $filename = $path.md5(rand()).'.png'; $frame = $movie->getFrame($i); $image = $frame->toGDImage(); imagepng($image,$filename); if (is_file($filename)) { $screens[] = $filename; } } } // return array( 'width' => $movie->getFrameWidth(), // 'height' => $movie->getFrameHeight(), // 'frame_count' => $frame_count, // 'bitrate' => $movie->getBitRate(), // 'video_bitrate' => $movie->getVideoBitRate(), 'video_codec' => $movie->getVideoCodec(), 'audio_codec' => $movie->getAudioCodec(), 'screens' => $screens, // ); }
Source: https://habr.com/ru/post/171239/
All Articles