You can do this with ffmpeg
and sox
:
for i in *.mp3 *.ogg *.flac
do
ffmpeg -i "$i" "$i.wav"
done
sox *.wav combined.wav
see also :
metaflac
flac [OPTIONS] [infile.wav | infile.aiff | infile.raw | infile.flac | infile.oga | infile.ogg | - ] ...
flac [-d | --decode | -t | --test | -a | --analyze ] [OPTIONS] [infile.flac | infile.oga | infile.ogg | - ] ...
Step 2
while read flacdompeg=$(dirname "$flac")/$(basename "$flac" .flac).mp3flac -d -c "$flac" | lame --cbr -b 192 - "$mpeg"
You can do this with ffmpeg
and sox
:
for i in *.mp3 *.ogg *.flac
do
ffmpeg -i "$i" "$i.wav"
done
sox *.wav combined.wav
I'd try converting them both to WAV and comparing their checksums.
ffmpeg -i file1.m4a file1.wav
ffmpeg -i file2.flac file2.wav
md5sum file1.wav
md5sum file2.wav
rm file?.wav
Compare the md5s produced. If they match, congratulations! Your files contain the same data. If they don't match, post the output of those commands here, and I'll look. Potentially there is a bitrate difference or something (there ought not to be... but there may be, I don't know.)
Note that the ffmpeg
s will generate comparatively
large intermediate files.
I don't know about ZFS, but the FLAC codec has a lot of different parameters, and the structure inside a FLAC file is not byte-aligned in general. So any slight change in settings is likely to give a very different bytestream. Do you know if the "identical" files were flacced with the same software, the same software version, and the same settings, on the same architecture?
Assuming that there are some differences in the bytestream (which would explain your 1.0 result), a way to test this would be to decompress and recompress all the FLAC files on the same machine. (Of course this operation doesn't drop any data, as long as metadata is kept.)
Metaflac is what you want
http://flac.sourceforge.net/documentation%5Ftools%5Fmetaflac.html
Install reaquired packages on Debian (Ubuntu):
sudo apt-get install cuetools shntool flac
Split flac file and fill id3 tags:
cuebreakpoints sample.cue | shnsplit -o flac sample.flac
cuetag sample.cue split-track*.flac
Some systems has cuetag.sh instead of cuetag.
EasyTAG can do all sorts of renaming based on metadata.
The compression level affects how much the song is compressed, but doesn't affect the quality of the sound:
The compressed files are always perfect "lossless" representations of the original data.Wikipedia
Higher compression levels save space, but take more processing power to encode. No matter what level you use, you will have a perfect replica of the CD quality. Album art isn't typically included in the sound file, but instead as an image file stored alongside the music.
flac is a command-line tool for encoding, decoding, testing and analyzing FLAC streams.
A summary of options is included below. For a complete description, see the HTML documentation.
General
Options
-v, --version
Show the flac version number
Show basic usage and a list of all options
Show detailed explanation of usage and all options
Decode (the default behavior is to encode)
Test a flac encoded file (same as -d except no decoded file is written)
Analyze a FLAC encoded file (same as -d except an analysis file is written)
Write output to stdout
Silent mode (do not write runtime encode/decode statistics to stderr)
Do not print anything of any kind, including warnings or errors. The exit code will be the only way to determine successful completion.
Do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options!
Treat all warnings as errors (which cause flac to terminate with a non-zero exit code).
Force overwriting of output files. By default, flac warns that the output file already exists and continues to the next file.
-o filename, --output-name=filename
Force the output file name (usually flac just changes the extension). May only be used when encoding a single file. May not be used in conjunction with --output-prefix.
--output-prefix=string
Prefix each output file name with the given string. This can be useful for encoding or decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing ’/’ (slash).
Automatically delete the input file after a successful encode or decode. If there was an error (including a verify error) the input file is left intact.
If encoding, save WAVE or AIFF non-audio chunks in FLAC metadata. If decoding, restore any saved non-audio chunks from FLAC metadata when writing the decoded file. Foreign metadata cannot be transcoded, e.g. WAVE chunks saved in a FLAC file cannot be restored when decoding to AIFF. Input and output must be regular files (not stdin or stdout).
--skip={#|mm:ss.ss}
Skip over the first number of samples of the input. This works for both encoding and decoding, but not testing. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second.
--until={#|[+|-]mm:ss.ss}
Stop at the given sample number for each input file. This works for both encoding and decoding, but not testing. The given sample number is not included in the decoded output. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. If a ’+’ (plus) sign is at the beginning, the --until point is relative to the --skip point. If a ’-’ (minus) sign is at the beginning, the --until point is relative to end of the audio.
--serial-number=#
When used with --ogg, specifies the serial number to use for the first Ogg FLAC stream, which is then incremented for each additional stream. When encoding and no serial number is given, flac uses a random number for the first stream, then increments it for each additional stream. When decoding and no number is given, flac uses the serial number of the first page.
Analysis
Options
--residual-text
Includes the residual signal in the analysis file. This will make the file very big, much larger than even the decoded file.
--residual-gnuplot
Generates a gnuplot file for every subframe; each file will contain the residual distribution of the subframe. This will create a lot of files.
Decoding
Options
--cue=[#.#][-[#.#]]
Set the beginning and ending cuepoints to decode. The optional first #.# is the track and index point at which decoding will start; the default is the beginning of the stream. The optional second #.# is the track and index point at which decoding will end; the default is the end of the stream. If the cuepoint does not exist, the closest one before it (for the start point) or after it (for the end point) will be used. If those don’t exist, the start of the stream (for the start point) or end of the stream (for the end point) will be used. The cuepoints are merely translated into sample numbers then used as --skip and --until. A CD track can always be cued by, for example, --cue=9.1-10.1 for track 9, even if the CD has no 10th track.
-F, --decode-through-errors
By default flac stops decoding with an error and removes the partially decoded file if it encounters a bitstream error. With -F, errors are still printed but flac will continue decoding to completion. Note that errors may cause the decoded audio to be missing some samples or have silent sections.
Encoding
Options
-V, --verify
Verify a correct encoding by decoding the output in parallel and comparing to the original
--replay-gain
Calculate ReplayGain values and store them as FLAC tags, similar to vorbisgain. Title gains/peaks will be computed for each input file, and an album gain/peak will be computed for all files. All input files must have the same resolution, sample rate, and number of channels. Only mono and stereo files are allowed, and the sample rate must be one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, or 48 kHz. Also note that this option may leave a few extra bytes in a PADDING block as the exact size of the tags is not known until all files are processed. Note that this option cannot be used when encoding to standard output (stdout).
--cuesheet=filename
Import the given cuesheet file and store it in a CUESHEET metadata block. This option may only be used when encoding a single file. A seekpoint will be added for each index point in the cuesheet to the SEEKTABLE unless --no-cued-seekpoints is specified.
--picture={FILENAME|SPECIFICATION}
Import a picture and store it in a PICTURE metadata block. More than one --picture command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for "||||FILENAME". The format of SPECIFICATION is
--sector-align
Align encoding of multiple CD format files on sector boundaries. See the HTML documentation for more information.
-S {#|X|#x|#s}, --seekpoint={#|X|#x|#s}
Include a point or points in a SEEKTABLE. Using #, a seek point at that sample number is added. Using X, a placeholder point is added at the end of a the table. Using #x, # evenly spaced seek points will be added, the first being at sample 0. Using #s, a seekpoint will be added every # seconds (# does not have to be a whole number; it can be, for example, 9.5, meaning a seekpoint every 9.5 seconds). You may use many -S options; the resulting SEEKTABLE will be the unique-ified union of all such values. With no -S options, flac defaults to ’-S 10s’. Use --no-seektable for no SEEKTABLE. Note: ’-S #x’ and ’-S #s’ will not work if the encoder can’t determine the input size before starting. Note: if you use ’-S #’ and # is >= samples in the input, there will be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if input size is not determinable).
-P #, --padding=#
Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 8192 bytes by default (or 65536 bytes if the input audio stream is more that 20 minutes long).
-T FIELD=VALUE, --tag=FIELD=VALUE
Add a FLAC tag. The comment must adhere to the Vorbis comment spec; i.e. the FIELD must contain only legal characters, terminated by an ’equals’ sign. Make sure to quote the comment if necessary. This option may appear more than once to add several comments. NOTE: all tags will be added to all encoded files.
--tag-from-file=FIELD=FILENAME
Like --tag, except FILENAME is a file whose contents will be read verbatim to set the tag value. The contents will be converted to UTF-8 from the local charset. This can be used to store a cuesheet in a tag (e.g. --tag-from-file="CUESHEET=image.cue"). Do not try to store binary data in tag fields! Use APPLICATION blocks for that.
-b #, --blocksize=#
Specify the block size in samples. Subset streams must use one of 192, 576, 1152, 2304, 4608, 256, 512, 1024, 2048, 4096 (and 8192 or 16384 if the sample rate is >48kHz).
-m, --mid-side
Try mid-side coding for each frame (stereo input only)
-M, --adaptive-mid-side
Adaptive mid-side coding for all frames (stereo input only)
-0..-8, --compression-level-0..--compression-level-8
Fastest compression..highest
compression (default is -5). These are synonyms for
other options:
-0, --compression-level-0
Synonymous with -l 0 -b 1152 -r 3
-1, --compression-level-1
Synonymous with -l 0 -b 1152 -M -r 3
-2, --compression-level-2
Synonymous with -l 0 -b 1152 -m -r 3
-3, --compression-level-3
Synonymous with -l 6 -b 4096 -r 4
-4, --compression-level-4
Synonymous with -l 8 -b 4096 -M -r 4
-5, --compression-level-5
Synonymous with -l 8 -b 4096 -m -r 5
-6, --compression-level-6
Synonymous with -l 8 -b 4096 -m -r 6
-7, --compression-level-7
Synonymous with -l 8 -b 4096 -m -e -r 6
-8, --compression-level-8
Synonymous with -l 12 -b 4096 -m -e -r 6
-e, --exhaustive-model-search
Do exhaustive model search (expensive!)
-A function, --apodization=function
Window audio data with given the apodization function. The functions are: bartlett, bartlett_hann, blackman, blackman_harris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann, kaiser_bessel, nuttall, rectangle, triangle, tukey(P), welch.
-l #, --max-lpc-order=#
Specifies the maximum LPC order. This number must be <= 32. For Subset streams, it must be <=12 if the sample rate is <=48kHz. If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors. Using fixed predictors is faster but usually results in files being 5-10% larger.
-p, --qlp-coeff-precision-search
Do exhaustive search of LP coefficient quantization (expensive!). Overrides -q; does nothing if using -l 0
-q #, --qlp-coeff-precision=#
Precision of the quantized linear-predictor coefficients, 0 => let encoder decide (min is 5, default is 0)
-r [#,]#, --rice-partition-order=[#,]#
Set the [min,]max residual partition order (0..16). min defaults to 0 if unspecified. Default is -r 5.
Format
Options
--endian={big|little}
Set the byte order for samples
--channels=#
Set number of channels.
--sample-rate=#
Set sample rate (in Hz).
--sign={signed|unsigned}
Set the sign of samples (the default is signed).
--input-size=#
Specify the size of the raw input in bytes. If you are encoding raw samples from stdin, you must set this option in order to be able to use --skip, --until, --cue-sheet, or other options that need to know the size of the input beforehand. If the size given is greater than what is found in the input stream, the encoder will complain about an unexpected end-of-file. If the size given is less, samples will be truncated.
--force-aiff-format
Force the decoder to output AIFF format. This option is not needed if the output filename (as set by -o) ends with .aiff. Also, this option has no effect when encoding since input AIFF is auto-detected.
--force-raw-format
Force input (when encoding) or output (when decoding) to be treated as raw samples (even if filename ends in .wav).
Negative
Options
--no-adaptive-mid-side
--no-decode-through-errors
--no-delete-input-file
--no-exhaustive-model-search
--no-mid-side
--no-padding
--no-qlp-coeff-precision-search
--no-residual-gnuplot
--no-residual-text
--no-sector-align
--no-seektable
--no-silent
--no-verify
--no-warnings-as-errors
These flags can be used to invert the sense of the corresponding normal option.
metaflac .
The programs are documented fully by HTML format documentation, available in /usr/share/doc/libflac-doc/html on Debian GNU/Linux systems.
This manual page was written by Matt Zimmerman mdz[:at:]debian[:dot:]org for the Debian GNU/Linux system (but may be used by others).