soluble-mediatools - php обертка для video conversions, transcoding, querying, thumbnailing, wraps around ffmpeg and ffprobe
<?php
use Soluble\MediaTools\Video\Config\FFProbeConfig;
use Soluble\MediaTools\Video\Exception\InfoReaderExceptionInterface;
use Soluble\MediaTools\Video\VideoInfoReader;
$infoReader = new VideoInfoReader(new FFProbeConfig('/path/to/ffprobe'));
try {
$videoInfo = $infoReader->getInfo('/path/video.mp4');
} catch (InfoReaderExceptionInterface $e) {
// see below for exceptions
}
$duration = $videoInfo->getDuration();
$frames = $videoInfo->getNbFrames();
$width = $videoInfo->getWidth();
$height = $videoInfo->getHeight();
// Or alternatively
['width' => $width, 'height' => $height] = $videoInfo->getDimensions();
https://github.com/soluble-io/soluble-mediatools/