laravel - Php FFMPEG request timout -
i using laravel 4.2
.
i working on project of uploading video. uploaded video should played in devices using php-ffmpeg
package git-hub
.
the requirement transcoding should done in background. using wamp 2.5
.
what doing is, after upload firing asynchronous ajax request
transcode video , after successful completion should insert record database containing video name, path etc.
the problem if upload large size video, facing error maximum execution time of 120 seconds exceeded
.
i know possible solution setting max_timelimit
in php.ini
don't think feasible solution because if there larger video, same error occurred again.
is there technique can bypass transcoding process in background?
my code below :
try{ $video_id = input::get('video_id'); $video_path = input::get('video_path'); $path = '/video/'.date('y').'/'.date('m'); $path .= '/'; $explode_filename = explode("/",$video_path); $save_filename = $explode_filename[sizeof($explode_filename)-1]; $ffmpeg = ffmpeg\ffmpeg::create(array('timeout'=>0)); $video = $ffmpeg->open($video_path); $format = new customvideo(); $format->setkilobitrate(1000) ->setaudiochannels(2) ->setaudiokilobitrate(256); $video->save($format, public_path().$path.$save_filename); //saving video video::where('id', '=', $video_id)->update(array('is_transcoded' => 1,'video_url'=>url($path.$save_filename))); } catch (exception $ex){ return response::json (["message"=>$ex->getmessage(), "code"=>$ex->getcode(), "trace"=>$ex->gettrace()]); }
Comments
Post a Comment