我是 Laravel 4 的新手。我已经安装了php-ffmpeg
在我本地的 Laravel 设置中,但我需要有关如何在 Laravel 4 中使用此 ffmpeg 的帮助?
假设你已经拥有ffmpeg
安装在本地主机服务器上,然后在 Laravel 中,您需要设置ffmpeg and ffprobe二进制文件,如下所示:
$ffmpeg = FFMpeg\FFMpeg::create(array(
'ffmpeg.binaries' => '/usr/local/Cellar/ffmpeg/2.1.3/bin/ffmpeg',
'ffprobe.binaries' => '/usr/local/Cellar/ffmpeg/2.1.3/bin/ffprobe',
'timeout' => 3600, // The timeout for the underlying process
'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use
));
通过这样做,您可以:
// set the path of the video file, which you might consider to get the input from the user
$video = $ffmpeg->open('video.mpg');
// apply filters to resize the clip
$video
->filters()
->resize(new FFMpeg\Coordinate\Dimension(320, 240))
->synchronize();
// crop a frame from a particular timecode
$video
->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
->save('frame.jpg');
// transcode clip
$video
->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4');
PHP-FFMpeg 文档中提供了更多示例github https://github.com/PHP-FFMpeg/PHP-FFMpeg
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)