What is the proper way to convert .flac files to 320 kBit/sec .mp3?
First of all you must make sure that it's installed.
sudo apt-get install libav-tools
It should have lame and flac codecs, now is just create a bash script to finish the job:
$ cat > flac2mp3
Here the shell will wait for your commands, copy and paste this:
#!/bin/bash
[[ $# == 0 ]] && set -- *.flac
for f; do
avconv -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"
done
Now press Ctrl + D. Make your script executable chmod +x flac2mp3
. Now go you can use it like this:
./flac2mp3 /path/with/all/my/flacs/*.flac
You can also copy the script to somewhere in your PATH
and then cd
to the directory with the flacs and execute it.
With regards to the following parameter used above:
-qscale:a 0
will not actually give you a exact 320k file, although it is probably the best setting to use anyway. The suggested settings actually give a target bitrate of 245 kbits/s with a range of 220-260. If you really wanted 320k mp3s you would have to go to CBR and use:
-c:a libmp3lame -b:a 320k
but you would need great ears to notice the difference...
Reference:
- https://wiki.archlinux.org/index.php/Convert_Flac_to_Mp3#With_FFmpeg
For Single File i use this and its work perfect for me.
avconv -i [FileName.flac] -c:a libmp3lame -b:a 320k [FileName.mp3]
I know this is a quite old thread, but I have had a similar task, so I created a little tool for converting FLAC to MP3. (Raspberry pi 3, with OSMC) Maybe someone will find this with the same search, that I did.
https://github.com/erdnuesse/flac-to-mp3
Features:
- Multithreaded
- preserves FLAC tags
- preserve relative directory structure
- does not delete, does not overwrite
It consists of 2 scripts, the first starts the given number of worker-instances (one for each core, or how many you want). While the second does the work.
It's based on avconv (my OSMC has 4 cores, but does not support ffmpeg out-of-the-box, so, meh, whatever.)
It's still running, so I hope, there will be no major setbacks.
Regards, Kay