首先安装ffmpeg
<?php set_time_limit(0) ; $cmd = "ffmpeg -i 'input/3.mp4' -r 1 -q:v 2 -f image2 images/pic-%03d.jpeg"; exec($cmd . " >> /var/log/php/cmd.log 2>&1",$log, $status); if($status == 0){ var_dump("执行成功"); } else { var_dump("执行失败"); }