I have a PHP script that calls exec() to convert video files using ffmpeg. The script works fine with smaller files, but larger files, usually around 20MB, produce a 500 Internal Server Error after the conversion has run for about 45 seconds.
The max_execution_time is set to 600 seconds (10 minutes) and the max post and upload sizes are set to 1000 MB. The server is Unix based and is not running in safe mode.
Although the issue only happens with larger sizes, I'm not even sure it's a file size issue. The script will pass with a 12.6MB MOV file but will fail with an 11MB MP4 file.
Below is the exec() line from my script:
exec('ffmpeg -y -i '.escapeshellarg($uploadFile).' -vcodec libx264 -ab 128k -ac 2 -b 640k -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -maxrate 10M -bufsize 10M -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 '.$convertFile);
Thanks!