Hi, all.
I have FFMPEG, and FFMPEG php installed on a server, and am trying to upload a video and convert it to flash (flv), it looks like it works, but i guess it doesnt...

Here is what is returned in the browser
built on Apr 23 2007 14:01:05, gcc: 3.4.4 [FreeBSD] 20050518

Here is my code

$id = htmlspecialchars($_SESSION['uid']);
$path = "../profiles/$id/videos";
$source = $_FILES['video']['tmp_name'];
$name = $_FILES['video']['name'];
$ext = strtolower(substr($name, -3));
$time = time();
$videoFile = $time.'.flv';
$infoFile = $time.'.tpl'; 
if ($ext){
$movedFile = "$path/$videoFile";
// The commented $encode_cmd's are the ones i also tried, i get the same output every time
//$encode_cmd = "/usr/local/bin/ffmpeg -i \"$source\" -acodec mp3 -ar 22050 -ab 32 -f flv \"$movedFile\"";
//$encode_cmd = "/usr/local/bin/ffmpeg -i \"$source\" -acodec mp3 -ar 22050 -ab 32 -f flv \"$movedFile\"";
//$encode_cmd = "export LD_LIBRARY_PATH=/usr/local/bin/ffmpeg/lame/lib; /usr/local/bin/ffmpeg/bin/ffmpeg -i '$source' -f '$path/$filename'";
//$encode_cmd = "export LD_LIBRARY_PATH=/usr/local/bin/ffmpeg/lame/lib; /usr/local/bin/ffmpeg -i '$source' -f '$path/$filename'";
$encode_cmd = "ffmpeg -i '$source' -f '$movedFile'";
print exec($encode_cmd) or die ('Could not convert video"');

The "../profiles/$id/videos" file is chmod-ed to 0777
I know most of the script works, if i add move_uploaded_file($source, $movedFile) Then the source file is moved...

Can anyone please tell me what i am doing wrong? And why the file isn't being converted to flv, or if it is, why isn't it getting put in the right place?

Thank you so much for your time
~Gabor

    5 months later

    Hi guys

    I am looking for exactly the same thing, a way to convert and upload using ffmpeg. I found this thread by searching, and thought it would better if I ask my question by replying to this one, since the subject matter is the same.

    Would greatly appreciate if someone can help. I have searched a lot and could not find even a single example / tutorials that work. 🙁

    Thanks again.

      2 years later

      I think the code $encode_cmd = "ffmpeg -i '$source' -f '$movedFile'"; has something wrong.
      you should replace with full ffmpeg path instead of just ffmpeg and will work

      here is the sample example /usr/bin/ffmpeg -i $source -ab 56 -ar 22050 -b 200 -r 15 -s 320x240 -f flv $fulldestination

        Write a Reply...