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',
            ],
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!