Home > Backend Development > PHP Tutorial > 七牛转码为m3u8格式,saveas后资源并没有另存?

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

WBOY
Release: 2016-06-06 20:16:22
Original
1794 people have browsed it

代码如下,结果.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>
Copy after login
Copy after login

回复内容:

代码如下,结果.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>
Copy after login
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template