title: ffmpeg convert wav to mp3 using php variable
body: <p>I am working on a php function to upload a .wav and also create an .mp3 version of it in the same folder. So far everything is working how it should except for when I try using:</p>
  
  <pre><code> shell_exec('ffmpeg -i ' . $file_path . '-f mp2 ' . $mp3name); 
  </code></pre>
  
  <p>within the function it isn't creating the .mp3 in the beats folder. </p>
  
  <p>I tried </p>
  
  <pre><code>shell_exec('ffmpeg -i test.wav -f mp2 test.mp3'); 
  </code></pre>
  
  <p>on its own and it worked great.</p>
  
  <p><strong>php Function:</strong></p>
  
  <pre><code>function upload_a_sound($user_id, $file_temp, $file_extn, $name, $uploader, $keywords) {
      $timecode = substr(md5(time()), 0, 10);
      $mp3name = 'beats/' . $timecode . '.mp3';
      $file_path = 'beats/' . $timecode . '.' . $file_extn;
      //$date = date('m-d-Y');
      move_uploaded_file($file_temp, $file_path);
      shell_exec('ffmpeg -i ' . $file_path . '-f mp2 ' . $mp3name); 
      require ('classAudioFile.php');
      $AF = new AudioFile;
      $AF-&gt;loadFile($file_path);
      $AF-&gt;visual_width=200;
      $AF-&gt;visual_height=200;
      $AF-&gt;visual_graph_color="#c491db";
      $AF-&gt;visual_background_color="#000000";
      $AF-&gt;visual_grid=false;
      $AF-&gt;visual_border=false;
      $AF-&gt;visual_graph_mode=0;
      $AF-&gt;getVisualization ('images/song/' . $timecode . '.png');
      $imageloc = 'images/song/' . $timecode . '.png';
      mysql_query("INSERT INTO `content` VALUES ('', '', '$name', '$uploader', '$keywords', '$file_path', '$imageloc', '$mp3name')");
  
  }
  </code></pre>