Mathi
Mathi

Reputation: 97

Audio convertion using ffmpeg on exec() php function

any body explain why exec(),shell_exec(), system() can not return any return value while executing ffmpeg commands.

ie: exec("Who am i", $output = array()); //here execution is success and $output is set an array value $output= shell_exec("Who am i"); //here execution is success and $output is set an array value system("Who am i", $output = array()); //here execution is success and $output is set an array value

but

exec('ffmpeg -i "$sourcepath/Test.mp3" -vn -acodec libvorbis -ab 128k -y $desnpath/TestTest.ogg"', $output = array());
//here execution is success but $output is not set an array value 
$output= shell_exec('ffmpeg -i "$sourcepath/Test.mp3" -vn -acodec libvorbis -ab 128k -y $desnpath/TestTest.ogg"');
//here execution is success but $output is not set an array value
system('ffmpeg -i "$sourcepath/Test.mp3" -vn -acodec libvorbis -ab 128k -y $desnpath/TestTest.ogg"', $output = array());
//here execution is success but $output is not set an array value

i don't know why..!?

please any body help me.

Upvotes: 0

Views: 141

Answers (1)

szatmary
szatmary

Reputation: 31120

It is because ffmpeg does not output anything to stdout. Its output is printed to stderr. If you are on a non windows system you can do exec('ffmpeg -i "$sourcepath/Test.mp3" -vn -acodec libvorbis -ab 128k -y $desnpath/TestTest.ogg 2>&1"', $output = array()); or you can use proc_open()

Upvotes: 1

Related Questions