Laravel ffmpeg и laravel queue - PullRequest
       2

Laravel ffmpeg и laravel queue

0 голосов
/ 14 ноября 2018

Здесь 'моя ситуация: я использую laravel ffmpeg и larvel queue для перекодирования видео.Кажется, все работает нормально.Работа идет отлично, но я замечаю, что когда она сохраняет конвертированное видео и сжимает его, сохраняя его в общедоступной папке приложения, но я хотела сохранить конвертированные видео в моем хранилище amazon s3. Может кто-нибудь помочь с этим

  //This is my controller

 public function store(StoreVideoRequest $request){

    $path=str_random(16). '.' . $request->video->getClientOriginalName();
   $request->video->move(public_path('app'), $path);


    $video=Video::create([
      'disk'=>'app',
       'original_name'=>$request->video->getClientOriginalName(),
       'path'=>$path,
       'title'=>$request->title,

    ]);

    ConvertVideoForStreaming::dispatch($video);

    return redirect('uploader')->with('message','Your video will be available shortly after we process it');
}


//This the job

 public function handle()
{
    // create a video format...
    $lowBitrateFormat = (new X264('libmp3lame', 'libx264'))->setKiloBitrate(500);

    $converted_name = $this->getCleanFileName($this->video->path);

    // open the uploaded video from the right disk...
    FFMpeg::fromDisk('local')
        ->open($this->video->path)

        // add the 'resize' filter...
        ->addFilter(function ($filters) {
            $filters->resize(new Dimension(320, 250));
        })

        // call the 'export' method...
        ->export()

        // tell the MediaExporter to which disk and in which format we want to export...
        ->toDisk('s3')
        ->inFormat($lowBitrateFormat)

        // call the 'save' method with a filename...
        ->save($converted_name);
            $imageName = Storage::disk('s3')->url($converted_name);
    // update the database so we know the convertion is done!
    $this->video->update([
        'converted_for_streaming_at' => Carbon::now(),
        'processed' => true,
        'stream_path' => $imageName
    ]);
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...