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 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题