[Ffmpeg-php-user] FFMPEG-PHP not quite working. Help!
Brought to you by:
tkirby
|
From: Alex K. <ak...@mc...> - 2007-02-27 12:14:38
|
I managed to get ffmpeg-php almost working and I'm proud of that. I've=20
got some problem trying to use the functionality of it. My webhost=20
doesn't give me access to inject the module into the php directory so=20
I tried a workaround and I had thought it worked. I loaded up the=20
test_ffmpeg.php file and it lists all the functions and versions of=20
the ffmpeg-module but it won't load a file and read information from=20
it. I started to streamline the test_ffmpeg.php file to see if=20
something else was causing the error and I always got the same result.=20
Here's my version of test_ffmpeg.php:=20
(I wish google had a better way of presenting text :) )=20
//-----------------------------------------------------------------------=
-----------------------------------=20
<?=20
/*=20
* This test script is not part of the automatic regression tests. It=20
serves=20
* as a simple manual test script and an example of the syntax for=20
calling=20
* the ffmpeg-php functions=20
*=20
* To run it from the command line type 'php -q ffmpeg_test.php 'or=20
from a=20
* browser * copy this file into your web root and point your browser=20
at it.=20
*/=20
ini_set("ffmpeg.allow_persistent", 1,1);=20
ini_set("display_errors", "on");=20
$extension =3D "../../../../../../kunden/homepages/29/d181545895/htdocs/ =
techlinks/void/ffmpeg/bin/ffmpeg-php/modules/ffmpeg.so";=20
// load extension=20
if (!extension_loaded($extension)) {=20
dl($extension) or die("Can't load extension $extension\n");=20
}=20
if (php_sapi_name() !=3D 'cgi') {=20
echo '<pre>';=20
}=20
printf("ffmpeg-php version string: %s\n", FFMPEG_PHP_VERSION_STRING);=20
printf("libavcodec build number: %d\n", LIBAVCODEC_BUILD_NUMBER);=20
printf("libavcodec version number: %d\n", LIBAVCODEC_VERSION_NUMBER);=20
printf("libavcodec build number: %d\n", LIBAVCODEC_BUILD_NUMBER);=20
print_class_methods("ffmpeg_movie");=20
print_class_methods("ffmpeg_frame");=20
print_class_methods("ffmpeg_animated_gif");=20
// get an array for movies from the test media directory=20
$movie =3D =
"/kunden/homepages/29/d181545895/htdocs/techlinks/void/ffmpeg/=20
bin/ffmpeg-php/tests/test_media/robot.avi";=20
echo "--------------------\n\n";=20
$mov =3D new ffmpeg_movie("robot.avi");=20
printf("file name =3D %s\n", $mov->getFileName());=20
printf("duration =3D %s seconds\n", $mov->getDuration());=20
printf("frame count =3D %s\n", $mov->getFrameCount());=20
printf("frame rate =3D %0.3f fps\n", $mov->getFrameRate());=20
printf("comment =3D %s\n", $mov->getComment());=20
printf("title =3D %s\n", $mov->getTitle());=20
printf("author =3D %s\n", $mov->getAuthor());=20
printf("copyright =3D %s\n", $mov->getCopyright());=20
printf("frame height =3D %d pixels\n", $mov->getFrameHeight());=20
printf("frame width =3D %d pixels\n", $mov->getFrameWidth());=20
printf("has audio =3D %s\n", $mov->hasAudio() =3D=3D 0 ? 'No' : =
'Yes');=20
printf("get pixel format =3D %s\n", $mov->getPixelFormat());=20
printf("get pixel aspect ratio =3D %s\n", $mov-=20
>getPixelAspectRatio());=20
printf("get video codec =3D %s\n", $mov->getVideoCodec());=20
printf("get audio codec =3D %s\n", $mov->getAudioCodec());=20
printf("get audio channels =3D %s\n", $mov->getAudioChannels());=20
printf("get bit rate =3D %d\n", $mov->getBitRate());=20
printf("get audio bit rate =3D %d\n", $mov->getAudioBitRate());=20
printf("get audio sample rate =3D %d \n", $mov-=20
>getAudioSampleRate());=20
printf("get video bit rate =3D %d\n", $mov->getVideoBitRate());=20
printf("get frame =3D %s\n", is_object($mov->getFrame(10)) ?=20
'true' : 'false');=20
printf("get frame number =3D %d\n", $mov->getFrameNumber());=20
echo "\n--------------------\n\n";=20
if (php_sapi_name() !=3D 'cgi') {=20
echo '</pre>';=20
}=20
/* FUNCTIONS */=20
function print_class_methods($class) {=20
echo "\nMethods available in class '$class':\n";=20
$methods =3D get_class_methods($class);=20
if (is_array($methods)) {=20
foreach($methods as $method) {=20
echo $method . "\n";=20
}=20
} else {=20
echo "No Methods Defined\n";=20
}=20
}=20
function getDirFiles($dirPath)=20
{=20
if ($handle =3D opendir($dirPath))=20
{=20
while (false !=3D=3D ($file =3D readdir($handle))) {=20
$fullpath =3D $dirPath . '/' . $file;=20
if (!is_dir($fullpath) && $file !=3D "CVS" && $file !=3D "." =
&& $file !=3D "..")=20
$filesArr[] =3D trim($fullpath);=20
}=20
closedir($handle);=20
}=20
return $filesArr;=20
}=20
?>=20
// --=20
end----------------------------------------------------------------------=
-------------------------------------------------=20
And yes, robot.avi is in the same directory as the php file. ;)=20
The orginal test_ffmpeg.php and my version always produces this result=20
in the webbrowser:=20
//-----------------------------------------------------------------------=
-------------------------------------------------------=20
ffmpeg-php version string: 0.5.0=20
libavcodec build number: 3348992=20
libavcodec version number: 3348992=20
libavcodec build number: 3348992=20
Methods available in class 'ffmpeg_movie':=20
ffmpeg_movie=20
getduration=20
getframecount=20
getframerate=20
getfilename=20
getcomment=20
gettitle=20
getauthor=20
getartist=20
getcopyright=20
getalbum=20
getgenre=20
getyear=20
gettracknumber=20
getframewidth=20
getframeheight=20
getframenumber=20
getpixelformat=20
getbitrate=20
hasaudio=20
getnextkeyframe=20
getframe=20
getvideocodec=20
getaudiocodec=20
getaudiochannels=20
getaudiosamplerate=20
getaudiobitrate=20
getvideobitrate=20
getpixelaspectratio=20
Methods available in class 'ffmpeg_frame':=20
ffmpeg_frame=20
togdimage=20
getwidth=20
getheight=20
resize=20
crop=20
iskeyframe=20
getpresentationtimestamp=20
getpts=20
Methods available in class 'ffmpeg_animated_gif':=20
ffmpeg_animated_gif=20
addframe=20
--------------------=20
//-----------=20
end----------------------------------------------------------------------=
----------------------------=20
Its never loading the video and display anything. I'm throughly=20
puzzled and I hope I can get some help from you guys. Its really=20
appriatchated.=20
Thanks again!,=20
Alex=20
|