Example #1
4
 public function convertAudioFile($input)
 {
     $ffmpeg = FFMpeg\FFMpeg::create();
     $audio = $ffmpeg->open($input);
     $format = new FFMpeg\Format\Audio\Wav();
     $format->on('progress', function ($audio, $format, $percentage) {
         echo "{$percentage} % transcoded";
     });
     $format->setAudioChannels(2);
     $audio->filters()->resample(96000);
     $audio->save($format, 'output/Output_file.wav');
 }
Example #2
1
function convertAudioFile($input)
{
    $file_path = dirname(__FILE__) . "/audio_files/" . $input;
    $ffmpeg = FFMpeg\FFMpeg::create();
    $audio = $ffmpeg->open($file_path);
    $format = new FFMpeg\Format\Audio\Wav();
    $format->on('progress', function ($audio, $format, $percentage) {
        echo "{$percentage} % transcoded";
    });
    $format->setAudioChannels(2);
    $audio->filters()->resample(96000);
    $audio->save($format, 'Output_file2.wav');
}