php - FFMPEG conversion using shell_exec timeout for large files -
i'm trying convert large (40mb) mov file mp4 using ffmpeg , php.
but gives me 504 time-out error on server. can fix without changing set_time_limit
?
here php code.
shell_exec($this->getffmpegpath() . ' -i ' . $path . ' -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset slower -crf 18 -vf "scale=trunc(in_w/2)*2:trunc(in_h/2)*2" ' . $convertedpath . '.mp4');
so, ideas on how convert without timeout ? appreciated.
you might want run converting in background. found this question addresses that, please more investigate on subject. can allow user refresh see whether process finished.
it might give better user experience (better looking @ page loading long time. there many places in connection may decide consider timeout: php engine, webserver, proxy, browser, depending on infra.
also should really careful shell_exec
. chances of on web misusing whatever want machine quite high. maybe not in way using today (depending on $path
, $convertedpath
come from), maybe in future update of code allow user specify resulting filename example.
Comments
Post a Comment