shell_exec echo'ing too fast or too late

后端 未结 1 1158
萌比男神i
萌比男神i 2021-01-28 03:18

So I read throug this article: https://trac.ffmpeg.org/wiki/PHP and found this:



        
相关标签:
1条回答
  • 2021-01-28 03:24

    You might want to use flush before you do your shell_exec. There are a few caveats to using this which are well explained in the php documentation page. Hope this helps.

    <?php
      echo "Starting ffmpeg...\n\n";
    
      ob_flush();
      flush();
      echo shell_exec("ffmpeg -i input.avi output.avi >/dev/null 2>/dev/null");
    
      // a sleep could effectively be the same as your shell_exec operation
      // sleep(5);
    
      echo "Done.\n";
      ob_end_flush();
    
    0 讨论(0)
提交回复
热议问题