ffmpeg-php permission denied on localhost
- by user572271
Hello, I am very new to php. I recently setup php on my mac and I am trying to setup ffmpeg-php to convert various videos to flv or other formats as desired. I used this tutorial FFmpeg Mac Installation and I got ffmpeg to work using the terminal, however, when I try to encode a movie using php I get an error. In my apache error_log file it says permission denied next to the flv file (shown below).
FFmpeg version 0.6, Copyright (c)
2000-2010 the FFmpeg developers
built on Dec 30 2010 08:36:24 with gcc
4.2.1 (Apple Inc. build 5646) (dot 1) configuration: --prefix=/usr/local
--enable-shared --disable-mmx --enable-libmp3lame --enable-gpl --enable-libfaad --enable-zlib --enable-libvorbis --enable-libfaac --enable-nonfree
libavutil 50.15. 1 / 50.15.
1 libavcodec 52.72. 2 /
52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2.
0 / 52. 2. 0 libswscale 0.11. 0 / 0.11. 0 Seems stream 1 codec frame rate differs from
container frame rate: 1200.00 (1200/1)
- 30.00 (30/1) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Users/myApple/Sites/AdHere/test.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt Duration: 00:00:02.04, start:
0.000000, bitrate: 1109 kb/s
Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16, 97 kb/s
Stream #0.1(eng): Video: h264, yuv420p, 640x480, 1027 kb/s, 30.15
fps, 30 tbr, 600 tbn, 1200 tbc
/Users/myApple/Sites/AdHere/movteststuff.flv:
Permission denied
I have no idea what the problem is. I am using the following php code:
<?php
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
$ffmpegInstance = new ffmpeg_movie('test.AVI');
echo "getDuration: " . $ffmpegInstance->getDuration() .
"<br>getFrameCount: " . $ffmpegInstance->getFrameCount() .
"<br>getFrameRate: " . $ffmpegInstance->getFrameRate() .
"<br>getFilename: " . $ffmpegInstance->getFilename() .
"<br>getComment: " . $ffmpegInstance->getComment() .
"<br>getTitle: " . $ffmpegInstance->getTitle() .
"<br>getAuthor: " . $ffmpegInstance->getAuthor() .
"<br>getCopyright: " . $ffmpegInstance->getCopyright() .
"<br>getArtist: " . $ffmpegInstance->getArtist() .
"<br>getGenre: " . $ffmpegInstance->getGenre() .
"<br>getTrackNumber: " . $ffmpegInstance->getTrackNumber() .
"<br>getYear: " . $ffmpegInstance->getYear() .
"<br>getFrameHeight: " . $ffmpegInstance->getFrameHeight() .
"<br>getFrameWidth: " . $ffmpegInstance->getFrameWidth() .
"<br>getPixelFormat: " . $ffmpegInstance->getPixelFormat() .
"<br>getBitRate: " . $ffmpegInstance->getBitRate() .
"<br>getVideoBitRate: " . $ffmpegInstance->getVideoBitRate() .
"<br>getAudioBitRate: " . $ffmpegInstance->getAudioBitRate() .
"<br>getAudioSampleRate: " . $ffmpegInstance->getAudioSampleRate() .
"<br>getVideoCodec: " . $ffmpegInstance->getVideoCodec() .
"<br>getAudioCodec: " . $ffmpegInstance->getAudioCodec() .
"<br>getAudioChannels: " . $ffmpegInstance->getAudioChannels() .
"<br>hasAudio: " . $ffmpegInstance->hasAudio();
exec('ffmpeg -i /Users/myApple/Sites/AdHere/test.mov /Users/myApple/Sites/AdHere/movteststuff.flv');
?>
I am able to see various parameters like filename, frameheight, framewidth, which leads me to believe that ffmpeg-php is kind of working, but maybe I am just doing something wrong in the exec() command. Anyone have any ideas. I have been struggling with setting up ffmpeg for quite some time now.
Thanks!
-Jon