php - 视频拼接无效 avconcat 求指教,下附代码和返回 信息截图
伊谢尔伦
伊谢尔伦 2017-04-11 09:16:42
[PHP讨论组]

1.因项目需要,使用avconcat接口拼接多个视频,使用后返回信息正常,但是没有效果
2.下附代码和返回信息截图:

        $auth = new Auth($this->accessKey, $this->secretKey);
        // 生成上传 Token
        $token = $auth->uploadToken($this->bucket);

        // 要上传文件的本地路径
        $filePath = $_FILES['videoname']['tmp_name'];

        // 上传到七牛后保存的文件名
        $key = time().rand(10000,99999).".mp4";

        // 初始化 UploadManager 对象并进行文件的上传。
        $uploadMgr = new UploadManager();

        $encodedUrl1 = $this->base64_urlSafeEncode('http://host/148430237126015.mp4');
        $encodedUrl2 = $this->base64_urlSafeEncode('http://host/148394565268224');
        $fops = 'avconcat/2/format/mp4/'.$encodedUrl1.'/'.$encodedUrl2;

        //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当间。
        $fops = $fops.'|saveas/'.$this->base64_urlSafeEncode($this->bucket.":".$key);
        $pfop = "avthumb/mp4/vb/1.4m";
        //转码完成后通知到你的业务服务器。(公网可以访问,并相应200 OK)
        $notifyUrl = 'http://host/index.php?g=Portal&m=QiNiu&a=index';

        //独立的转码队列:https://portal.qiniu.com/mps/pipeline
        $pipeline = 'xxxx';
        
        
        $policy = array(
            'persistentOps' => $pfop,
            'persistentNotifyUrl' => $notifyUrl,
            'persistentPipeline' => $pipeline
        );
        $token = $auth->uploadToken($this->bucket, null, 3600, $policy);

        // 调用 UploadManager 的 putFile 方法进行文件的上传。
        list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);
        
        $pfop = new PersistentFop($auth, $this->bucket, $pipeline, $notifyUrl);
        list($id, $err) = $pfop->execute($key, $fops);
        echo "合成结果:";
        if ($err != null) {
            print_r($err);
        } else {
            print_r($id);
        }

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(1)
迷茫

$fops = $fops.'|saveas/'.$this->base64_urlSafeEncode($this->bucket.":".$key);这里$key导致的,caodan

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

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