HydrogenAudio

Lossless Audio Compression => Lossless / Other Codecs => Topic started by: 2012 on 2012-02-07 21:58:10

Title: FFMpeg/libav and SoX don’t output identical WAVs when decoding FLAC/WV
Post by: 2012 on 2012-02-07 21:58:10
Hello.

I noticed that the result of decoding (lossless) files to WAV is not bit-exact when using ffmpeg/avconv vs. sox.

The difference is very small but It doesn't take place only at the header of the file. xdelta tells me it takes place every 8388608 bytes.

Also, the filesize is different (e.g. 51525310 with avconv and 51525308 with sox).

The result is exactly the same if the source is FLAC or WavPack. So, this is not codec-specific.

Is there an explanation to this? Is one of the tools at fault or the difference is not in audio data?
Title: FFMpeg/libav and SoX don’t output identical WAVs when decoding FLAC/WV
Post by: db1989 on 2012-02-07 22:11:08
The difference is very small but It doesn't take place only at the header of the file. xdelta tells me it takes place every 8388608 bytes.

What is the difference?

Are you comparing the actual audio streams or just the entire files (i.e. including frame headers, etc.)?

If the former, do you mean that the decoders produce different streams to one another? What about when they are compared to the original input file? Does either produce an identical stream to that?

Quote
Also, the filesize is different (e.g. 51525310 with avconv and 51525308 with sox).

Again: does either produce an identical file-size to the input WAV?

Sorry, but a lot more information is needed here.
Title: FFMpeg/libav and SoX don’t output identical WAVs when decoding FLAC/WV
Post by: 2012 on 2012-02-07 22:44:16
The difference is very small but It doesn't take place only at the header of the file. xdelta tells me it takes place every 8388608 bytes.

What is the difference?

Are you comparing the actual audio streams or just the entire files (i.e. including frame headers, etc.)?


I was comparing the files.

Quote
Quote
Also, the filesize is different (e.g. 51525310 with avconv and 51525308 with sox).

Again: does either produce an identical file-size to the input WAV?



I don't have a source WAV. The sources available to me right now are FLACS and WavPacks.

Quote
If the former, do you mean that the decoders produce different streams to one another? What about when they are compared to the original input file? Does either produce an identical stream to that?


I didn't check this before posting (sorry). The streams are indeed identical.

Running:
Code: [Select]
 avconv -i $wav_file -f u16le $raw_file

gives bit-exact raw files.

And taking any wav file then compressing with wavpack or flac then decoding back to WAV gives the same file per tool (All WAVs decoded using the same tool are bit-exact regardless of the decoder of the input).

So, I guess both tools are doing their job properly.