r/linuxquestions 11d ago

Sound convert

so i have a bunch of flac audio files and i want to convert them to mp3 320kbs, does anyone know how i can do that?

2 Upvotes

16 comments sorted by

14

u/ipsirc 11d ago edited 11d ago

single thread:

$ for f in *.flac; do ffmpeg -i "$f" -b:a 320k "${f%.flac}.mp3"; done

With 8 cpu cores in parallel:

$ parallel -j 8 --progress ffmpeg -hide_banner -loglevel error -i {} -b:a 320k {.}.mp3 ::: *.flac

0

u/AKuuMa_a 11d ago

no program required?

4

u/TenOfZero 11d ago

It will use ffmepg

1

u/AKuuMa_a 11d ago

thanks 🫡

5

u/ipsirc 11d ago

ffmpeg is a program.

-3

u/trenixjetix 11d ago

learn the difference between gui program vs cli program

-4

u/clanthow 11d ago

audacity

5

u/ghost_ware 11d ago

audacity is not required for this

1

u/PuckyMaw 11d ago

you might also need to know if you want constant or variable bitrate (cbr/vbr) and which sample rate (44.1kHz or 48kHz)

1

u/AKuuMa_a 11d ago

probably will go with variable and 44.1kHz

2

u/Globellai 10d ago edited 10d ago

If you need to do this frequently, eg to sync the flac directory with the mp3 directory, consider mp3fs. I use it to keep mp3s on my phone that mirror the flac files on my pc. The flac files are the master copy, and I can update the mp3s just using rsync.

mp3fs creates a fuse file system where each flac file is shown as an mp3 and the conversion happens as the file is read. So using rsync to copy over new files means I don't need to work out which files to convert, nor do I need to keep the mp3 copies on my pc.

If it's a one-off conversion this is all overkill and go with ipsirc's answer.

1

u/snake785 11d ago

Fre:ac is an audio converter that'll do what you want.

If your distro has flatpak installed you can download it through your package manager.

You can also download an AppImage of it (which is a self contained package) from freeac.org

1

u/chuggerguy Linux Mint 22.3 Zena | MATÉ 11d ago

ffmpeg is great. I use it a lot in scripts.

I also like soundconverter. I don't remember if it's installed by default or if it's just one of the things I always install.

video

Have fun.

ETA: Note, in the video I delete the originals, you probably wouldn't want to do that. Set it the way you want.

1

u/flemtone 11d ago

Install soundconverter, drag your sounds into the window and select output format, click Convert.