tags:

views:

228

answers:

3

I know this isn't exactly a programming question per se, but rather a settings question, but still:

I'm trying to convert video with FFMPEG with a PHP script, following this tutorial:

http://vexxhost.com/blog/2007/05/20/how-to-convertencode-files-to-flv-using-ffmpeg-php/

FFMPEG works perfectly and I've used it from the command line a number of times. PHP also seems to work fine. I've also installed ffmpeg-php and it seems to be loading file.

The problem lies when I try to do the following in PHP:

$srcFile = "p1.avi";

$ffmpegObj = new ffmpeg_movie($srcFile);

No matter what, PHP will return this:

Warning: can't open movie file p1.avi in /var/www/converter.php on line xx

Obviously, whatever call I do afterwards with $ffmpegObj will throw a fatal error. I'm absolutely stuck and extensive googling hasn't helped much.

If you must know, I'm using Ubuntu 9.04 with the default LAMP server packages as well as php5-ffmpeg, and I've compiled ffmpeg following a tutorial I found on Ubuntuforums (I'd link to it but stackoverflow won't let me)

Thanks!

A: 

Try to specify full path to you movie like following:

$srcFile = "/home/path/something/p1.avi";
$ffmpegObj = new ffmpeg_movie($srcFile);
Ivan Nevostruev
Thanks for the suggestion, but I've already tried as many combinations as I could before asking here.My web server root directory is /var/www .My script is /var/www/converter.php .My video is on /var/www/flashvideo/p1.avi .I've tried the following paths:flashvideo/p1.avi/var/www/flashvideo/p1.aviI've also tried moving p1.avi to /var/www and trying with p1.avi and /var/www/p1.avi with no luck ;_;
ziritrion
Try to move it to `/tmp/1.avi` and set 666 permisions: `chmod 666 /tmp/1.avi`.
Ivan Nevostruev
+1  A: 

Does the user you run the script as have permission to open the file? Check with ls -l /var/www/flashvideo/p1.avi

Stuart
+1  A: 

FINALLY! As some of you suggested, neither the directory nor the file had the proper permissions to be modified by my script. I changed them and everything works now =) . I'm such an idiot for not noticing this for hours :P

Thank you guys!

ziritrion