Jump to content

FFmpeg


The Little Guy

Recommended Posts

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 :(

Link to comment
https://forums.phpfreaks.com/topic/79322-ffmpeg/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-401599
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-401637
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-402253
Share on other sites

  • 2 years later...

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);

 

Link to comment
https://forums.phpfreaks.com/topic/79322-ffmpeg/#findComment-1062244
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.