我想实现不同的视频拼接功能,于是用了avconcat接口,结果execute执行后并没有报错,但是,没效果,我不知道是什么原因,请大神指点下,下附代码:
$auth = new Auth($this->accessKey, $this->secretKey);
$bucket = $this->bucket;
//转码是使用的队列名称。
$pipeline = '';
//$key = time().rand(10000,99999).".mp4";
//$key = $_FILES['videoname']['tmp_name'];
$key = '2.mp4';
//转码完成后通知到你的业务服务器。
$notifyUrl = 'http://375dec79.ngrok.com/notify.php';
$pfop = new PersistentFop($auth, $bucket, $pipeline, $notifyUrl);
$encodedUrl1 = $this->base64_urlSafeEncode('http://ojaa3ua92.bkt.clouddn.com/2.mp4');
$encodedUrl2 = $this->base64_urlSafeEncode('http://ojaa3ua92.bkt.clouddn.com/3.mp4');
$fops = 'avconcat/2/format/mp4/'.$encodedUrl1.'/'.$encodedUrl2;
//可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当间。
$fops = $fops.'|saveas/'.$this->base64_urlSafeEncode("xxx:123.mp4");
list($id, $err) = $pfop->execute($key, $fops);
echo "合成结果:";
if ($err != null) {
print_r($err);
} else {
echo "PersistentFop Id: $id\n";
}
返回的结果:合成结果:PersistentFop Id: z0.58749bed45a2650cfdb57c80
明白了,因为队列用的是 $pipeline = '';合成时间较长。。。。。一时看不到效果,需要用$pfop->status($id);查看进度。