首页  >  文章  >  后端开发  >  七牛转码为m3u8格式,saveas后资源并没有另存?

七牛转码为m3u8格式,saveas后资源并没有另存?

WBOY
WBOY原创
2016-06-06 20:16:221748浏览

代码如下,结果.m3u8文件另存在VIDEO_BUCKET,但是资源切片文件.ts仍旧还在STORE_BUCKET,请问怎么解决?

<code>function weike_pfop() 
{
    $auth = new Auth(QINIU_ACCESS, QINIU_SECRET);
    $key = '2-2-1457275914928-WP2PCS使用入门.avi';
    
    // 转码是使用的队列名称
    $pipeline = 'weike';
    $pfop = new PersistentFop($auth, STORE_BUCKET, $pipeline);
    
    // 要进行转码的转码操作
    $fops = "avthumb/m3u8/s/640x360/vb/1.25m";
    
    // 可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当间
    $savekey = Qiniu\base64_urlSafeEncode(VIDEO_BUCKET.':test.m3u8');
    $fops = $fops.'|saveas/'.$savekey;
    
    list($id, $err) = $pfop->execute($key, $fops);
    echo "\n====> pfop avthumb result: \n";
    
    if ($err != null) 
    {
        var_dump($err);
    } 
    else 
    {
        echo "PersistentFop Id: $id\n";
    }
}</code>

回复内容:

代码如下,结果.m3u8文件另存在VIDEO_BUCKET,但是资源切片文件.ts仍旧还在STORE_BUCKET,请问怎么解决?

<code>function weike_pfop() 
{
    $auth = new Auth(QINIU_ACCESS, QINIU_SECRET);
    $key = '2-2-1457275914928-WP2PCS使用入门.avi';
    
    // 转码是使用的队列名称
    $pipeline = 'weike';
    $pfop = new PersistentFop($auth, STORE_BUCKET, $pipeline);
    
    // 要进行转码的转码操作
    $fops = "avthumb/m3u8/s/640x360/vb/1.25m";
    
    // 可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当间
    $savekey = Qiniu\base64_urlSafeEncode(VIDEO_BUCKET.':test.m3u8');
    $fops = $fops.'|saveas/'.$savekey;
    
    list($id, $err) = $pfop->execute($key, $fops);
    echo "\n====> pfop avthumb result: \n";
    
    if ($err != null) 
    {
        var_dump($err);
    } 
    else 
    {
        echo "PersistentFop Id: $id\n";
    }
}</code>

目前可能只能将m3u8文件另存,建议你将文件都存储在STORE_BUCKET,关于这个问题我也会向开发反馈。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn