二进制文件自动获取失败,手动指定二进制路径

$config = array(
    'ffmpeg.binaries'  => '/usr/bin/ffmpeg',
    'ffprobe.binaries' => '/usr/bin/ffprobe'
),
$ffmpeg = FFMpeg\FFMpeg::create($config);

获取上传视频的尺寸(宽、高)

$config = array(
    'ffmpeg.binaries'  => '/usr/bin/ffmpeg',
    'ffprobe.binaries' => '/usr/bin/ffprobe'
),
$ffmpeg = FFMpeg\FFMpeg::create($config);

$video = $ffmpeg->open($file->getRealPath());
$video_streams = $video->getStreams();

$width = 0;
$height = 0;
foreach ($video_streams as $key => $value) {
    empty($value->get('width')) ?: $width = $value->get('width');
    empty($value->get('height')) ?: $height = $value->get('height');
}

标签: none

添加新评论