开发者

know when ffmpeg completes converting

am using ffmpeg i开发者_如何学JAVAn one of my sites with PHP , i convert files using the php exec function , actually it did me some headache trying to figure out WHEN this ffmpeg completes the file conversion after executing the exec command :( is there anyway to do that ?

Thanks


From what I've found, the exec function blocks until the ffmpeg conversion is complete.

For example, you can run ffmpeg like this in your PHP script:

exec($encode, $output);

(Where $encode is the ffmpeg command as a string, and $output is an array of each line of output from ffmpeg.)

For me, this exec command blocks my PHP script from continuing until ffmpeg conversion is complete, at which point my PHP script continues on, which seems to be how it is described in the PHP manual:

http://php.net/manual/en/function.exec.php

So, you can tell when exec is complete by following the exec command with another PHP command on the next line in your script that notifies you conversion is complete, or updates a database, or what-have-you.

FYI, I believe that pushing the exec command "into the background" means running the exec command but having the PHP script continue on simultaneously (i.e. asynchronously). For running the exec command in the background, Google "PHP background exec" or "php multi-process", such as:

http://www.php.net/manual/en/ref.exec.php#80241 http://www.sitecrafting.com/blog/to-run-php-code-in/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜