The Little Guy Posted November 28, 2007 Share Posted November 28, 2007 I would like to know why this doesn't work... any one know? <?php $loca = '../../tzfiles.com/users/ryan/file.mpg'; $new = '../../tzfiles.com/users/ryan/file.flv'; if(exec("/home/ryannaddy/bin/ffmpeg -i $loca -ar 22050 -ab 32 -f flv -s 320x240 $new")) echo 'SUCCESS!!!'; else echo 'FAILED '; ?> the output says FAILED Quote Link to comment https://forums.phpfreaks.com/topic/79322-ffmpeg/ Share on other sites More sharing options...
Jeffrey Posted November 28, 2007 Share Posted November 28, 2007 have you tryed excuting your command thru command line and not php? go in w/e directory the php file is trying to execute from # /home/ryannaddy/bin/ffmpeg -i ../../tzfiles.com/users/ryan/file.mpg -ar 22050 -ab 32 -f flv -s 320x240 ../../tzfiles.com/users/ryan/file.flv see whats happens from there Quote Link to comment https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-401599 Share on other sites More sharing options...
The Little Guy Posted November 29, 2007 Author Share Posted November 29, 2007 OK, I go it: <?php $loca = '../../tzfiles.com/users/ryan/file.mpg'; $new = '../../tzfiles.com/users/ryan/file.flv'; exec("/usr/bin/ffmpeg -i ".$loca." -ar 22050 -ab 32 -f flv -s 320x240 ".$new); echo 'Done!!!'; ?> Now... there is still an issue... I can not do this to files with a space, how can I fix that, so I can? The only way I can think of is to take the file, rename it to something with no space, then rename the final file back to the original state, but that seems like more work than needed. Is there an easier way? Quote Link to comment https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-401637 Share on other sites More sharing options...
Daniel0 Posted November 29, 2007 Share Posted November 29, 2007 Quote the filenames. I.e. /usr/bin/ffmpeg -i "file name with spaces.mpg" -ar 22050 -ab 35 -f flv -s 320x240 "other filename with spaces.flv" Quote Link to comment https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-402151 Share on other sites More sharing options...
The Little Guy Posted November 29, 2007 Author Share Posted November 29, 2007 Quote the filenames. I.e. /usr/bin/ffmpeg -i "file name with spaces.mpg" -ar 22050 -ab 35 -f flv -s 320x240 "other filename with spaces.flv" I am assuming that it doesn't matter if it is single or double quotes, but its linux, and I don't know much about linux. Quote Link to comment https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-402253 Share on other sites More sharing options...
Kizzie33 Posted May 23, 2010 Share Posted May 23, 2010 I spent ages looking for this, so when i found it i had to share it on the web. It works !!! ( took me 2 days) Warning this only works if you already have the ffmpeg libary already installed ( my host did). you need the laod extenstion bit $extension = "ffmpeg"; $extension_soname = $extension . "." . PHP_SHLIB_SUFFIX; $extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname; // load extension if(!extension_loaded($extension)) { dl($extension_soname) or die("Can't load extension $extension_fullname\n"); } $exec_string = 'ffmpeg -i /home/parkhall/public_html/bands/design/uploads/001Spin.mp3 /home/parkhall/public_html/bands/design/uploads/omfg.mp3'; exec($exec_string); Quote Link to comment https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-1062244 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.