Botch
Botch

Reputation: 501

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 (i.e. exec() in PHP) but not when run directly from the command line? Any tips?

Upvotes: 0

Views: 344

Answers (2)

Christian Gollhardt
Christian Gollhardt

Reputation: 17014

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>

Upvotes: 1

Multimedia Mike
Multimedia Mike

Reputation: 13216

I'm thinking this has something to do with pipes. I.e., 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?

Upvotes: 0

Related Questions