8

I need to convert a flac file to a wav file without changing sample rate and bit depth. As far as I know changing these properties may distort the audio, so how do i specify them not to be changed?

Also, is there any way to prevent metadata to be written to the output file?

Edit: Apparently this is an XY Problem, I'm sorry, I'm new here. My problem is that I don't want to install flac on my OS X, because I'm trying to sandbox everything I use, so I need a single executable file, such as ffmpeg. I'll try @slhck's suggestion and check whether sample rate and bit depth change.

Edit: ffmpeg only preserves sample rate. Bit depth needs to be set manually.

user3580089
  • 93
  • 2
  • 2
  • 6

3 Answers3

13

ffmpeg will not change sample rate unless you tell it to (or the output codec does not support it, but then it will most probably fail). So this should be enough:

ffmpeg -i input.flac output.wav

ffmepg will however not preserve bit depth and default to 16-bit encoding, so if your input is 24 bit, you have to use:

ffmpeg -i input.flac -c:a pcm_s24le output.wav

As for removing metadata, see Strip metadata from all formats with FFmpeg -- you basically only add the -map_metadata -1 option.

slhck
  • 235,242
7

While it does not use ffmpeg as you indicate in the title that you want to do, to convert a FLAC file to .wav you can simply pass it through flac using the --decode (-d) switch.

flac --decode input.flac will produce input.wav as output, containing the same audio data.

You can add --no-keep-foreign-metadata to make flac throw away any non-audio data in the input. (It is the opposite of --keep-foreign-metadata Save/restore WAVE or AIFF non-audio chunks.)

user
  • 30,336
0

Unless you have to use ffmpeg for some reason, sox will convert files for you, maintains the original bit depth by default and will remove all comments if you add

--comment ""
martinwguy
  • 1,090