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

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 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失