Convertire file .flac in .mp3

In questo modo utilizzando ffmpeg di default vengono anche passati i tag presenti sul brano originale

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

Per dettagli:

Explanation of the used arguments in this example:

  • -i – input file
  • -vn – Disable video, to make sure no video is included if the source would be a video file
  • -ar – Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options.
  • -ac – Set the number of audio channels. For output streams it is set by default to the number of input audio channels. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options. So used here to make sure it is stereo (2 channels)
  • -ab – actually seems to be changed, so should be replaced for newer ffmpeg version to -b:a 192k Converts the audio bitrate to be exact 192kbit per second
  • -f – Force input or output file format. The format is normally auto detected for input files and guessed from the file extension for output files, so this option is not needed in most cases.

https://trac.ffmpeg.org/wiki/Encode/MP3