Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can successfully run an executable from the command line, but when I try to do the same thing from PHP with exec() the outcome is different.

The command is:

ffmpeg -i a.wav -i a.m2v a.mpeg

When running from PHP, the Movie Player simply states 'The file contains no playable streams'.

You know why?

share|improve this question
    
what command are you running? –  John T Jan 7 '10 at 12:16
    
the command is 'ffmpeg -i a.wav -i a.m2v a.mpeg' –  user23945 Jan 7 '10 at 12:20
    
and what is the different output ffmpeg is giving you? –  John T Jan 7 '10 at 12:21
    
from terminal the output file is a working video. When run from PHP though, the Movie Player simply states 'The file contains no playable streams'. –  user23945 Jan 7 '10 at 12:22
    
But is the output generated? And does it have a non-zero file length? –  Arjan Jan 7 '10 at 13:25

1 Answer 1

up vote 0 down vote accepted

I would check the environment variables. Maybe ffmpeg can't find (or can't access due to permission restritions) its resources when you run it from php.

share|improve this answer
    
Good point. The ffmpeg executable is found though and can use the files with right permissions, do you have any other names of the variables? –  user23945 Jan 7 '10 at 13:12
    
I'm not very familiar with ffmpeg, maybe it could use some environment variables that point explicitly to the directories where it finds its codecs? –  geek Jan 7 '10 at 13:47
    
I'd also investigate if ffmpeg has a "-v" option that you could use to increase its verbosity when you run it from php. Then you could capture the output and investigate it, maybe it will complain there about something that it is missing. –  geek Jan 7 '10 at 13:48
    
Solved it! The -v option was indeed useful, i used ffmpeg -v 5 and got useful information. The problem was that ffmpeg terminated after a while, maybe phps' max_exection time, dont know. However, I now run nohup php myfile.php. Thank you! –  user23945 Jan 7 '10 at 16:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.