I'm using queue job with laravel 5.4. But I can't pass file content On job.
//Controller
public function trimVideoByFFmpeg()
{
try {
$video = Input::file('video');//Video file
$video_encode = base64_encode($video);//convert in base64_encode
Log::info($video_encode);
$job = new TrimJob($video_encode); //pass on job for trim
$data = $this->dispatch($job);
$result = $job->getResponse();
$response = $result;
}catch (Exception $e) {
Log::error("checkFFmpeg : ", ['Exception' => $e->getMessage(), '\nTraceAsString' => $e->getTraceAsString()]);
$response = "Something wrong";
}
return $response;
}
//TrimJob.php
public function __construct($video,$name)
{
Log::info('-------------------------------------------------------');
Log::info('__construct()');
$this->video = base64_decode($video,true);
$cmd = "C:\\ffmpeg\\bin\\ffmpeg.exe -i $this->video 2>&1"; //Current Only get video info
Log::info(['cmd'=>$cmd]);
exec($cmd, $output, $result);
log::info('__construct',[$output]);
}
public function handle()
{
$video = $this->video;
$output_file = Config::get('constant.OUTPUT_VIDEO_FFmpeg') . "test.mp4";;
//$cmd = "C:\\ffmpeg\\bin\\ffmpeg.exe -i $video -ss 01.00 -t 02.00 -y $output_file 2>&1";
$cmd = "C:\\ffmpeg\\bin\\ffmpeg.exe -i $video 2>&1";
Log::info($cmd);
exec($cmd, $output, $result);
log::info('handle',[$output]);
}
This video file content successfully working in __construc() but is not working in handle(). How can I pass file data in queue?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire