[MEncoder-users] Different output when Mencoder runned by PHP script and from a command line

Robert Nichols rnicholsNOSPAM at comcast.net
Mon Mar 17 01:12:10 CET 2008


Al wrote:
> Robert Nichols <rnicholsNOSPAM <at> comcast.net> writes:
> 
>> Just guessing here, but ...
>> Are you certain that the divx2pass.log statistics file is not being lost
>> or overwritten between the two passes?  Perhaps you need to use the
>> -passlogfile option to put that file in a safe place and with a unique
>> name.
> 
> Thanks for the answer.
> 
> I don't think it's possible, because I run nothing between these two passes.
> Original PHP code is:
> 
> $first = "/usr/local/bin/mencoder -really-quiet -fps ".$frameRate."/1001 -vf
> scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts
> vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1
> -ofps ".$frameRate."/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1
> -srate 22050 -of lavf -lavfopts format=flv -o ".$outputFile."
> /home/re/ff/logo".$frameRate.".avi ".$inputFile;
> 
> $second = "/usr/local/bin/mencoder -really-quiet -fps ".$frameRate."/1001 -vf
> scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts
> vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=2
> -ofps ".$frameRate."/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1
> -srate 22050 -of lavf -lavfopts format=flv -o ".$outputFile."
> /home/re/ff/logo".$frameRate.".avi ".$inputFile;
> 
> print system("cd /usr/local/bin/");
> print system($first);
> print system($second);

First, that 'system("cd /usr/local/bin")' has no effect.  It is executed in
a shell process which changes its own working directory and then terminates,
leaving the parent process exactly where it was before.

Second, I notice the the "-really-quiet" option suppresses the error message
that would result from a missing divx2pass.log file.  I know almost nothing
about PHP, but it's entirely possible that the commands are being executed
in a directory that lacks write permission for that statistics file.

Here's something to try.  Instead of executing the commands in separate
shells, run them all in the same shell by making a simple loop:

    cd somewhere; for PASS in 1 2; do /usr/local/bin/mencoder ... vpass=$PASS ...; done

Be sure the chosen working directory is somewhere that is writable by a
PHP script.  Alternatively, use the -passlogfile option with a full path
that includes a suitable directory.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the MEncoder-users mailing list