I need to convert a batch of flac 48000 24bit samples to 41000 16bit. I'd like to use ffmpeg from the command line.

  • 4
    What did you try?
    – Destroy666
    Jun 27, 2023 at 23:12
  • for file in *.flac; do ffmpeg $file -r 44100 -c 1 -b 16 "$(basename $file .flac)_44100_mono_16bit.flac" -V; done Jun 28, 2023 at 0:20
  • 1
    And what was the outcome? What problem led you to asking this question? You should edit the question with any additional details (which should be there in the 1st place).
    – Destroy666
    Jun 28, 2023 at 0:51
  • The problem is the parameters do not fit what i need to do, just as the other suggestions. What's not clear in the question? I need a command string that will convert any .flac file inside the working dir from 48000 24bit to 44100 16bit. Jun 28, 2023 at 1:04
  • We are not a script writing service. Show us what you've tried, the research you've done, etc, and we may be able to help point out the answer that solves your problem. Jun 29, 2023 at 17:14

1 Answer 1


Adapted trivally from ffmpeg FLAC 24 bit 96khz to 16 bit 48khz:

ffmpeg -i Brindisi.flac -af aresample=out_sample_fmt=s16:out_sample_rate=41000 Brindisi_41000_16.flac

And to check:

file Brindisi*
Brindisi.flac:          FLAC audio bitstream data, 24 bit, stereo, 44.1 kHz, 8918016 samples
Brindisi_41000_16.flac: FLAC audio bitstream data, 16 bit, stereo, 8291126 samples

If you want to convert a number of files in a directory the easiest approach is to drop this into a loop:

for f in *.flac
    [ -s "${f%.*}_41000_16.flac" ] && continue

    printf 'Processing: %s\n' "$f"
    ffmpeg -i "$f" -af aresample=out_sample_fmt=s16:out_sample_rate=41000 "${f%.*}_41000_16.flac"
    # mv -f -- "${f%.*}_41000_16.flac" "$f"    # Replace original

As always, prefix the ffmpeg with echo to see what's going on before it actually does anything.

If you run this loop more than once across the same set of files, it will ignore the output files from files that have already been processed. You can of course delete these with rm *._41000_16.flac.

  • I don't think this would work 'cause I need to convert all the .flac files in a directory. Jun 28, 2023 at 0:18
  • @black-clover applying a command to multiple files is usually very straightforward as you can just put a standard shell loop around the command. I've done this for you as part of my answer Jun 28, 2023 at 10:15
  • Thanks, this worked, except is there a way to simply replace the original files with the new ones without creating new files with the '_41000_16.flac addition? How to modify the script might be obvious to you but I'm a newbie. Jun 28, 2023 at 15:28
  • Yes you can do that but it does mean there'll no longer be any programmatic way of identifying which files have been processed and which have not Jun 28, 2023 at 21:01
  • That's okay, I'm working on copies and it would save me time. If you could add this option in your answer that be wonderful. Jun 28, 2023 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .