Convert AVI,MPG to FLV on the server.

Good afternoon! Problem converting from AVI to FLV.

    $input = "video.avi";
    $output = "video.flv";
   $ffmpeg = new ffmpeg_movie($input);
    system("ffmpeg -i $input -ar 44100 -f flv $output");

The call to system and ffmpeg happens because if you specify the wrong name in $input, then php swears that the file is not found. However, the video.flv file is not created. What’s wrong, I don’t understand! And which is better, FLV or SWF?

Answer 1, authority 100%

  1. Run the command ffmpeg -i source -ar 44100 -f flv targetin a terminal.
  2. Run the previous command as the same user as the script and in the same folder.
  3. Run the script with the full path to ffmpeg and permissions to the write folder 777.

Answer 2

check if the folder where you want to save the file is open for writing.

Answer 3

Alternatively, you can write commands directly to the php script. exec() returns text (response about the result of the command)