Heim  >  Artikel  >  Backend-Entwicklung  >  七牛转码为m3u8格式,saveas后资源并没有另存?

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

WBOY
WBOYOriginal
2016-06-06 20:16:221747Durchsuche

代码如下,结果.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,关于这个问题我也会向开发反馈。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:ThinkPHP怎么连接MySQLNächster Artikel:微信开发者问题