开发者

ffmpeg-php and shell_exec

I'm using ffmpeg-php for uploading videos and converting videos from

"ogv", "mp4", "avi", "flv", "ogg", "mpg", "wmv", "asf" and "mov"

formats to

"flv" , "ogg" and "flv" formats.

I'm doing this by:

        $command1='ffmpeg -i '.$Source." -ar 44100 -ab 128k -s wvga -aspect 4:3 -f FLV -y ".$dest;
        $command2="ffmpeg -i ".$Source." -acodec libfaac -ab 128k -ac 2 -vcodec libx264  -vpre slow -threads 10 -s wvga -aspect 4:3 -f mp4 -y ".$dest;
        $command3="ffmpeg -i ".$Source." -acodec libvorbis -ab 128k -ac 2 -vcodec libtheora  -threads 10 -s wvga -aspect 4:3 -f ogg -y ".$dest;
        @shell_exec($command1.";".$command2.";".$command3);

When applying those commands on .ogv videos it works fine but when applying on .MOV it does not work and no errors displays although when I paste the command into the terminal it works fine.

Hint: Script is running by cron job.

is there any suggestions for thi开发者_开发技巧s problem?


Most likely the script is running out of time before the conversion takes place.

Increase the execution time of your scripts.

Although its not a recommend solution for production. You might want to run background processes to do the conversion and use the PHP script just to upload the video.


  1. What happens when you run the problem part outside of a crontab?

  2. are you saving the output of your crontab entry to files? i.e.

    59 12 1 1 * { myPhpScript ; } > /tmp/myPhpScript.log 2>&1` ...

( The semicolon preceding the closing '}' is critical)

This captures any stdout or stderr messages to a logfile.

I hope this helps.

P.S. as you appear to be a newish user, if you get an answer that helps you please remember to mark it as accepted, and/or give it a + (or -) as a useful answer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜