Convert audio file to FLAC with ffmpeg?

23

3

can I convert one of this format to compatible 16000.0 Sample Rate FLAC file?

kAudioFormatLinearPCM                   = 'lpcm',
kAudioFormatAppleIMA4                   = 'ima4',
kAudioFormatMPEG4AAC                    = 'aac ',
kAudioFormatMACE3                       = 'MAC3',
kAudioFormatMACE6                       = 'MAC6',
kAudioFormatULaw                        = 'ulaw',
kAudioFormatALaw                        = 'alaw',
kAudioFormatMPEGLayer1                  = '.mp1',
kAudioFormatMPEGLayer2                  = '.mp2',
kAudioFormatMPEGLayer3                  = '.mp3',
kAudioFormatAppleLossless               = 'alac'

I tried using ffmpeg

ffmpeg -i audio.xxx -acodec flac audio.flac

but result is

FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
Mac OSX universal build for ffmpegX
  configuration:  --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264 
  libavutil version: 49.0.0
  libavcodec version: 51.9.0
  libavformat version: 50.4.0
  built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
Input #0, wsaud, from 'audio.alac':
  Duration: 00:00:03.8, start: 0.000000, bitrate: 199 kb/s
  Stream #0.0: Audio: adpcm_ima_ws, 24931 Hz, stereo, 199 kb/s
Unable for find a suitable output format for 'audio.flac'

I also installed flac codec for mac, but nothing...

I tried also use convtoflac.sh (from http://legroom.net/software/convtoflac) but result is similar.

Any idea to convert in flac?

elp

Posted 2011-09-23T10:20:45.963

Reputation: 343

Your version of ffmpeg has probably been built without FLAC support. Try ffmpeg -formats | grep flac and ffmpeg -codecs | grep flac to see. – user1686 – 2011-09-23T10:29:00.263

Flac was present: D A flac! – elp – 2011-09-23T10:32:40.697

In both 'codecs' and 'formats'? Also, the D means "decoding". Without Encoding support you're not going to make it work. – user1686 – 2011-09-23T10:34:44.793

ffmpeg -codecs | grep flac won't work! I don't find any codec options.... – elp – 2011-09-23T10:38:45.697

Answers

27

Forget the FFmpeg version that's included within ffmpegX – it's really old. Obviously it wasn't compiled with FLAC support.

You could:

Then, just try it again:

ffmpeg -i audio.xxx -c:a flac audio.flac

slhck

Posted 2011-09-23T10:20:45.963

Reputation: 182 472

I reinstall theora and now it's ok, because link returns No such keg: /usr/local/Cellar/libtheora. Thanks a lot man! – elp – 2011-09-23T12:54:09.763

There's also a compilation guide on the ffmpeg wiki, though I'm not really sure how to judge if it's better or worse than the ones you've already linked to.

– evilsoup – 2013-04-27T15:31:14.200

@evilsoup Thanks. The guide didn't exist at the time of writing this answer, but it's definitely better than what I've found so far. Now I remember editing the Wiki page myself a few months ago. – slhck – 2013-04-27T15:58:16.790

2

on linux 12.04 lts desktop this

ffmpeg -i audio.xxx -c:a flac audio.flac

has this error

" Unrecognized option 'c:v' Failed to set value 'flac' for option 'c:v' "

this works without error

ffmpeg -i input.flv(mp4)  output.flac

Conor

Posted 2011-09-23T10:20:45.963

Reputation: 153

Would adding -vn help? It ought to tell ffmpeg to ignore the video stream. – Marius Gedminas – 2015-11-10T19:32:49.380