php - 视频拼接无效 avconcat 求指教,下附代码和返回 信息截图

 平凡数码广场 发布于 2022-11-15 19:58

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);
        }

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

    2022-11-15 20:46 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有