dqwh1219 2018-09-01 20:33
浏览 233
已采纳

FFMPEG:如何在FFMPEG Php中使用S3 url

I'm generating an image frame from a video in a particular time using FFMPEG Laravel SDK in Laravel 5.6. If I used the local path for video file it's working fine but When I'm using URL directly it's giving an error. I want to use the video which is stored in the s3 bucket.

File not found at path: https:/xxxxx.cloudfront.net/uploaded_videos/filename.mp4

My code as below.

$videoFile = env('CLOUDFRONT')."/".$resultStatusValue[0]->video_url;

FFMpegFacade::fromDisk('s3')
->open($videoFile)   
->getFrameFromSeconds($timeToSecond)
->export()
->toDisk('s3')
->save($s3Path);

Hereafter generated image should be upload to the s3 bucket.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • douluanzhao6689 2018-09-03 04:23
    关注

    If specify the disk as s3 just simply key name is enough.

    $videoFile = $resultStatusValue[0]->video_url;  //= upload/video1.mp4
    
    FFMpegFacade::fromDisk('s3')
    ->open($videoFile)   
    ->getFrameFromSeconds($timeToSecond)
    ->export()
    ->toDisk('s3')
    ->save($s3Path);
    

    In Additional if you want uploaded file to public. specify visibility on config/filesystems.php

    's3' => [
                'driver' => 's3',
                'key' => 'your-key',
                'secret' => 'your-secret',
                'region' => 'your-region',
                'bucket' => 'your-bucket',
                'visibility' => 'public',
            ],
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python结合Matlab仿真忆阻器
  • ¥35 有人会注册whatsaop协议号吗?
  • ¥15 lead dbs 无法导入影像数据
  • ¥15 多目标MPA算法优化编程实现
  • ¥15 反激PWM控制芯片调研
  • ¥15 Python for loop减少运行时间
  • ¥15 fluent模拟物质浓度udf
  • ¥15 Collection contains no element matching the predicate
  • ¥20 冻品电商平台的搜索是怎么实现的
  • ¥15 如何搞一个可以控制、显示马达频率