ruby on rails - Convert mp3 to flac files -
i'm trying find way of converting mp3 flac files using ruby (preferably) server-side. have horde of audio transcribe using google speech api accepts flac. (among other things). can find flac2mp3 convertor work on laptop, went through code , unfortunately seems calling system command requires having codecs installed locally. .
is there api maybe me? or easy way install codecs , run sort of command on heroku.
@orde linked exiting question recommends following:
ffmpeg -i input.mp3 output.flac
this not ruby command, system command (i.e. unix or windows)
to call system command ruby, can use backticks or system
.
for example, after you've installed ffmpeg
system
def convert_mp3_to_flac(mp3_path) flac_path = mp3_path.gsub(".mp3", ".flac") system("ffmpeg -i #{mp3_path} #{flac_path}") end
Comments
Post a Comment