欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-06-14 14:59:54
...
代码如下,结果.m3u8文件另存在VIDEO_BUCKET,但是资源切片文件.ts仍旧还在STORE_BUCKET,请问怎么解决?
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";
    }
}

回复内容:

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

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

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

相关标签: 七牛云存储 php