PHP 使用avconcat拼接视频无效
ringa_lee
ringa_lee 2017-04-11 09:11:05
[PHP讨论组]

我想实现不同的视频拼接功能,于是用了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

ringa_lee
ringa_lee

ringa_lee

全部回复(1)
PHPz

明白了,因为队列用的是 $pipeline = '';合成时间较长。。。。。一时看不到效果,需要用$pfop->status($id);查看进度。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号