Help - Search - Members - Calendar
Full Version: settings used during encoding
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
malikgwada
hi, i'd like to know if it was possible to know what compression level was used to encode a flac file? I can't find this information using flac or metaflac. i also tried foobar with wine (i use linux). thanks in advance for your help smile.gif
pdq
If you are worried about the compression level then why don't you just recompress them to whatevel level you like?
malikgwada
QUOTE(pdq @ Mar 24 2008, 01:42) *

If you are worried about the compression level then why don't you just recompress them to whatevel level you like?

because i have something like 500+ albums and i'd like to reencode only those that i did not encode at q5.
but i guess i'll have to make a script to reencode everything and preserve tags & replaygain values..
perilsensitive
You can re-encode a flac file without losing any metadata using only flac itself:

CODE

flac -5 -V -f foo.flac


The above will do what you want. This tells flac to decode foo.flac, re-encode it at compression level 5, verify the new compressed file against the original decoded WAV data, copy all metadata blocks (including tags) from the input flac, and overwrite the original file when done.

The overwriting part sounds scary, but flac actually does all of the encoding to a temp file first, then only replaces your original file if everything was successful. If there was an error or you kill the encoder partway through the process, your original file is still there, completely untouched.

malikgwada
QUOTE(perilsensitive @ Mar 26 2008, 22:38) *

You can re-encode a flac file without losing any metadata using only flac itself:

CODE

flac -5 -V -f foo.flac


The above will do what you want. This tells flac to decode foo.flac, re-encode it at compression level 5, verify the new compressed file against the original decoded WAV data, copy all metadata blocks (including tags) from the input flac, and overwrite the original file when done.

The overwriting part sounds scary, but flac actually does all of the encoding to a temp file first, then only replaces your original file if everything was successful. If there was an error or you kill the encoder partway through the process, your original file is still there, completely untouched.

thanks smile.gif i'll try that (didn't think it would be that easy)
perilsensitive
[/quote]
thanks smile.gif i'll try that (didn't think it would be that easy)
[/quote]

Of course, if you don't trust flac to not screw up your original file, you could tell flac to encode to a different file using the -o option, then have your script replace the original if flac returns successfully. All metadata is still transferred, so something like this should work too:

CODE

for f in *.flac; do
    flac -V -5 -o "$f.tmp" "$f" && mv -f "$f.tmp" "$f"
done


As for determining the settings a file was encoded with, I think older versions of flac could do that. The code for that was getting pretty messy, so it was taken out. The flac mailing list might have more info.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.