0

I am attempting to install ffmpeg-php on my Dreamhost VPS. It runs Debian.

I am under the impression that it is quite easy using 'sudo apt-get install php5-ffmpeg'

I have tried this, it appears to install fine.

My problem is, I'm not sure where it installs and how I get to it.
When i run the code in php I always get a message saying 'class ffmpeg_movie not found'
I believe this means ffmpeg-php is not installed correctly or my path to it is wrong. I have tried locating it, but I do not know where it is installing. I ran the install in /usr/bin, where ffmpeg is. Maybe I need to run it in a php directory? I don't know.

Any help would be appreciated

2
Contributors
11
Replies
14
Views
5 Years
Discussion Span
Last Post by cereal
0

still no luck, same error

Fatal error: Class 'ffmpeg_movie' not found in /home/fsgcom/freescreengreen/verify_video.php on line 101

0

From the homepage:

If you've the installed ffmpeg-php extension as a shared library but haven't set it to auto-load in your php.ini file, you'll need to use the PHP dl() function to make ffmpeg-php available to your scripts. Add the following PHP code to the beginning of scripts you want to call ffmpeg-php methods in.

So maybe is this, check on usage section, here: http://ffmpeg-php.sourceforge.net/

Anyway, to update the list of files that locate can find, run sudo updatedb

0

Ok, here's a status update.

I have installed FFMPEG and PHP-FFMPEG and flvtools2 using apt-get install

I am running this script in my php:

// Set our source file
$srcFile = $_FILES["file1"]["tmp_name"];
$destFile = $path1;
$ffmpegPath = "/usr/bin/ffmpeg";
$flvtool2Path = "/usr/bin/flvtool2";
	
// Create our FFMPEG-PHP class
$ffmpegObj = new ffmpeg_movie($srcFile);
	
// Save our needed variables
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
	
// Call our convert using exec()
exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile);
	
function makeMultipleTwo ($value) {
	if ($value % 2)
		return $value - 1;
	else
		return $value;
}

I am receiving this error:
Fatal error: Class 'ffmpeg_movie' not found

I have looked around and apparently that means that it installed wrong. Does anyone know why the class can not be found or how I might solve that problem?

0

Did you read documentation that I linked to you? Did you tried to load the extension with dl()?

<?php
$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");
}
?>

What happens if you run this code?

0

Fatal error: Call to undefined function dl()

let me ask you, do you think that there are some unintended spaces in that code?

$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;

It seems like the spaces around the . are extra, does that matter?

Edited by megachip04: n/a

0

Ok, so apparently dl() is not in 5.3 so i reverted back to 5.2fastcgi...now I am actually getting this error

Warning: dl() [function.dl]: Unable to load dynamic library '/ffmpeg.so' - /ffmpeg.so: cannot open shared object file: No such file or directory in /home/fsgcom/freescreengreen/verify_video.php on line 10
Can't load extension /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so

0

ITS WORKING!!! kind of...

I copied ffmpeg.so to the correct directory (it got saved somewhere else)

Now the problem I am running into is when I upload larger files (> 7Mb) it seems to just give up. This is not a ffmpeg issue though. It's like it tries uploading it, then it just decides to pass the form without any values and the verification.php page errors out on the first textfield check. I have tried raising my limits in my php.ini file to 20M, doesn't seem to be making a difference. I even changed the processing lengths to like 3000seconds, it does not make it that far. Any ideas? Maybe there is a better way to go about this than php forms and $_FILES?

0

Hi! Try to increase Timeout on apache config file, default value is 300.
Then on php.ini change:

max_execution_time = 600
max_input_time = 600
upload_max_filesize = 20M

Side note: on PHP 5.3 dl() is disabled by default, but for testing you can enable it on php.ini enable_dl = On

0

assuming that in the apache config 300 means 5 minutes. It is not even taking 3 minutes to error out. I have set the php.ini file as suggested but still no luck. I also increased the post_max_size or something like that to 20M. Still no luck.

as far as 5.3, is there a reason dl() is disabled by default? Or is it ok to enable it and use it?

0

Yes, dl() is disabled because is not stable with some SAPI, that's the interface between PHP and the servers and is still enabled on CLI and CGI. In PHP you can load extension in two ways: one is through dl() function; the other method is to edit php.ini file and add extension=ffmpeg.so Try to increase memory_limit on php.ini, default should be 128M. Hope it works because I haven't other ideas. Bye :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.