-2

Hello guys i am tring to convert videos using FFmpeg...

  1. I moved ffmpeg.exe in same folder with upload.php

  2. I tryed this codes in upload.php:

    $randname = (rand(0,1000));
    $file_data=date("d-m-Y-H-i-s");
    $file_name=$file_data.$randname;
    move_uploaded_file($file_tmp,"vidconvert/".$file_name);
    exec (ffmpeg -i vidconvert/.$file_name videos/.$file_name.mp4);
    echo "Success";
    
  3. I want to get the file in vidconvert folder, and copy converted video to videos folder

Note: when i check the vidconfert folder, the file is uploaded succesfully

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
Halid Kyazim
  • 25
  • 1
  • 8
  • [Please don't add fake "tags" to your title](https://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles). There is a real tagging system; use that instead. Also, smiley faces have no place in the vast majority of SO posts; they never belong in your title. – ChrisGPT was on strike Apr 25 '17 at 15:55
  • 1
    You need to put the exec command in quotes; and lose the periods in front of $filename too. – l'L'l Apr 25 '17 at 15:56
  • OK i added: exec ("ffmpeg -i vidconvert/.$file_name videos/.$file_name.mp4"); but still not working.. – Halid Kyazim Apr 25 '17 at 15:59
  • 1
    Halid, what does "not working" mean? Do you get an error message? Note that you didn't follow the second part of the previous comment's suggestion. – ChrisGPT was on strike Apr 25 '17 at 16:00
  • No i don't have any error message, just i want to get the video where is uploaded, convert it and move it into the **videos** folder – Halid Kyazim Apr 25 '17 at 16:03

1 Answers1

0

To see what's going, use:

exec ("ffmpeg.exe -i vidconvert/{$file_name} videos/{$file_name}.mp4",$output);
echo $output;

the $output will contain the execution results (if any error it should appear in there), and also use relative/full path to files

Med.ZAIRI
  • 154
  • 5