Repairing FLAC files: Difference between revisions

From Hydrogenaudio Knowledgebase
mNo edit summary
mNo edit summary
 
Line 21: Line 21:
Encode back to FLAC:
Encode back to FLAC:


  flac --best *.wav
  flac -f --best *.wav


Restore the tags:
Restore the tags:

Latest revision as of 04:32, 30 July 2014

If a FLAC file is corrupted and you only want to save what exists, rather than re-rip from CD or re-acquire by some other method.

In Linux, for a single file:

metaflac --export-tags-to somesong.tags somesong.flac
flac -F -d somesong.flac
flac -f --best somsong.wav
metaflac --import-tags-from somesong.tags somesong.flac
rm somesong.wav somesong.tags

For multiple FLAC files:

Save the tags:

find -name "*.flac" -exec metaflac --export-tags-to '{}'.tags '{}' \;

Decode to WAV:

flac -F -d *.flac

Encode back to FLAC:

flac -f --best *.wav

Restore the tags:

find -name "*.flac" -exec metaflac --import-tags-from '{}'.tags '{}' \;

Cleanup:

rm *.wav *.tags