Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert .flac to .mp3 with ffmpeg, keeping all metadata

How can I convert .flac to .mp3 with ffmpeg, keeping all metadata (that is converting Vorbis comment in .flac files to ID3v2 metadata of .mp3)?

like image 889
Vito Gentile Avatar asked Sep 29 '14 22:09

Vito Gentile


People also ask

Can you convert FLAC to MP3 without losing quality?

Convert FLAC to MP3 with EaseUS Video Converter This converter supports both FLAC and MP3, and you can easily turn the audio into another format without quality loss. Sometimes you may have a significant amount of FLAC audio files that need to be processed, and the batch conversion is for this situation.

Does converting FLAC to FLAC lose quality?

Compressed and uncompressed Converting an audio file to FLAC means you are compressing it to occupy less space compared to WAV, but without any noticeable loss in quality.

Does FFmpeg support FLAC?

As slhck says, ffmpeg appears unable to recognise flac.


2 Answers

The following command keeps high quality on .mp3 (320 kbps), and metadata from .flac file are converted to ID3v2 format, which can be included in .mp3 files:

ffmpeg -i input.flac -ab 320k -map_metadata 0 -id3v2_version 3 output.mp3 
like image 184
Vito Gentile Avatar answered Sep 19 '22 15:09

Vito Gentile


Perfect answer above. I use it together with find to add all FLAC files in a subtree to iTunes with this command

find . -name "*.flac" -exec ffmpeg -i {} -ab 160k -map_metadata 0 -id3v2_version 3 {}.mp3 \; 

To automatically add the resulting files to iTunes, get the iTunes import directory with

find ~/Music/ -name "Automatically Add*" 

result e.g.

/Users/sir/Music//iTunes/iTunes Media/Automatically Add to iTunes.localized 

Then run e.g.

find . -name "*.mp3" -exec mv {} "/Users/sir/Music//iTunes/iTunes Media/Automatically Add to iTunes.localized/" \; 

To automatically add all the converted tracks to iTunes.

like image 37
user2707001 Avatar answered Sep 21 '22 15:09

user2707001