代码如下:
$con = array('ffmpeg.binaries' => 'path_to_ffmpeg',
'ffprobe.binaries' => 'path_to_ffprobe',
'timeout' => 3600,//底层进程的超时时间
'ffmpeg.threads' => 12
);
$logger = 'path_to_/ffmpeg.log';
$watermarkPath = 'path_to_logo.PNG';
$ffmpeg = FFMpeg::create($con);
$video = $ffmpeg->open('path_to_test.mp4');
$frame = $video->frame(TimeCode::fromSeconds(2));
$frame->save('path_to_image.jpg');
$video->filters()
->watermark($watermarkPath, array(
'position' => 'relative',
'bottom' => 50,
'right' => 50,
));
$format = new X264();
$format->on('progress', function ($video, $format, $percentage) {
echo "$percentage % transcoded";
});
$video->save($format,'path_to_video.mp4');
我在看官方文档的时候save的第一个参数要format的接口,但是我看网上写的blog第一个都是传视频对应格式类的实例化,请问这个具体到底怎么用?
HUWWW
杨__羊羊