Here' my situation I am using laravel ffmpeg and larvel queue to transcode videos. Everything seems to be working fine. The job processes great, but I am noticing that when its saves the video that was converted and compressed it saving it in the public app folder, but I wanted save the converted videos to my amazon s3 bucket.Can someone help with this
//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
]);
}