The ffmpeg from command line generates preview files and two separate two-pass conversion that when run from a shell script, execute successfully.
Running the commands via php's exec(/usr/bin/ffmpeg) or through exec(name_of_shell_script) generates preview files successfully. THe strange behavior is that the movies will generate, then truncate. ffmpeg log files are generated successfully, the out put file I can watch grow in size as the conversion continues, and then, when complete it appears, the files are truncated....
The only things that have changed on the system are changing from mod_php to mod_fcgi and php_cgi, but the error logs show nothing unusual except for
mod_fcgid: stderr: wmv, files3/1qwj, 1qwj.wmv
supressing output of the shell
scriptname.sh > /dev/null 2>&1
does not change the outcome.
should shell_exec be used? Is it a unix permissioning?
This is in ubuntu 10.04.1
This solution doesn't apply http://stackoverflow.com/questions/2504842/ffmpeg-running-in-command-line-but-not-php
EDIT:
looks like it might have something to do with the two pass encoding. The two pass encoding works fine from command line, but from the PHP env the shell overwrites something on the second pass.
nice -n 11 /usr/bin/ffmpeg -y -i $1 -r 30000/1001 -b 1M -bt 2M -vcodec libx264 -threads 0 -pass 1 -vpre /usr/share/ffmpeg/libx264-fastfirstpass.ffpreset -an movie.flv
nice -n 11 /usr/bin/ffmpeg -y -i $1 -r 30000/1001 -b 1M -bt 2M -vcodec libx264 -threads 0 -pass 2 -vpre /usr/share/ffmpeg/libx264-hq.ffpreset -acodec libfaac -ac 2 -ar 48000 -ab 192k movie.flv
$1 is the input filename
found https://roundup.ffmpeg.org/issue1829
Edit:
when done here are the log file artifacts
-rw-r--r-- 1 www-data www-data 0 2010-09-19 19:02 ffmpeg2pass-0.log
-rw-r--r-- 1 www-data www-data 0 2010-09-19 19:02 movie.flv
-rw-r--r-- 1 www-data www-data 153466 2010-09-19 19:02 movie.jpg
-rw-r--r-- 1 www-data www-data 358803 2010-09-19 19:02 movie_preview.jpg
-rw-r--r-- 1 www-data www-data 410283 2010-09-19 19:02 x264_2pass.log
-rw-r--r-- 1 www-data www-data 5759257 2010-09-19 19:02 x264_2pass.log.mbtree
opened new ticket at request of maintainer https://roundup.ffmpeg.org/issue2238
Edit: looks like the issue is the audio for wmv files