3

I have audio files on my server and wanted to convert them into flac format in order to convert them into text. Please let me know how can we achieve that..

PrashJ
  • 71
  • 2
  • 6
  • You can start by doing some research on the topic with your favorite search engine. – Takarii Jan 23 '17 at 13:39
  • "convert them into text"... i'm baffled - *how* do you, in any meaningful way, convert an audio file in a text file? – Franz Gleichmann Jan 23 '17 at 14:23
  • 1
    Yes, we can convert any audio files into textual format using Google's Speech API, or IBM's watson platform apis. I have done this. But for these APIs we needed to pass the flac format of audio files for which I am looking – PrashJ Jan 23 '17 at 15:28

2 Answers2

3

You can use FFmpeg: https://ffmpeg.org/

ffmpeg -i input.mp3 output.flac

There is a php wrapper for the ffmpeg binary on github. https://github.com/PHP-FFMpeg/PHP-FFMpeg

Michael
  • 405
  • 4
  • 10
  • Thanks Michael for your response...I wanted to ask you a query ...do I needed to have FFmpeg installed on my server, so that I can use it. Right? Do I have to pass this command only for conversion? I mean what else do we need to initiate this command? – PrashJ Jan 23 '17 at 15:25
2

In case you can't install ffmpeg you might want to try this free API:

<?php
$url = 'http://server.com/sound.mp3';
$data = json_decode(file_get_contents('http://api.rest7.com/v1/sound_convert.php?url=' . $url . '&format=flac'));

if (@$data->success !== 1)
{
    die('Failed');
}
$flac = file_get_contents($data->file);
file_put_contents('sound.flac', $flac);
Jack
  • 173
  • 1
  • 3