简体   繁体   中英

ffmpeg encoding freezes when executed from a script (php/c#/etc.) but not from the command line

I have tried encoding with ffmpeg via a PHP script, but the process freezes at a certain point. When the same command is run via the command line in Windows it encodes just fine.

I have tried different videos, which aren't corrupted and don't use any exotic codecs or anything.

What could be the reason the process freezes when run from a script (ie exec() in PHP) but not when run directly from the command line? Any tips?

I have had a similar Problem. For me, my webserver has had a maximum execution time.

For IIS (web.config):

<system.web>
    <httpRuntime executionTimeout="180" />
</system.web>

For other Server google about

maximum execution time <webservername>

I'm thinking this has something to do with pipes. Ie, the FFmpeg output is redirecting into a pipe that is never being drained by another process so the FFmpeg/PHP process blocks.

Some questions:

  • You're testing command lines via the Windows console; is PHP also running in a Windows environment?
  • Is the PHP transcoding process showing any CPU usage at all? Is it maxing out a CPU or not showing up at all?
  • What does the exec() call look like, exactly?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM