Skip to main content

Topic: corrupted(?) 24-bit FLAC file not playable (Read 18651 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
mmh, foobar2000 v0.9.5.1 doesn't playback 24 bit flac files properly here! foobar basically can read the file, but the output gets distorted!

Reaper for example plays it fine!


FIXED
  • Last Edit: 05 March, 2009, 02:49:41 AM by Dandruff

  • DotNoir
  • [*][*][*][*]
  • Members (Donating)
corrupted(?) 24-bit FLAC file not playable
Reply #1
mmh, foobar2000 v0.9.5.1 doesn't playback 24 bit flac files properly here! foobar basically can read the file, but the output gets distorted!

here an example: http://www.outburst-audio.com/misc/24-bps.flac (1.2 MB)



Reaper for example plays it fine!


The FLAC file is corrupted, got this error with the FLACs own FLACTester (comes with the FLAC installer)
Code: [Select]
[1/1]    C:\Users\Antti\Downloads\24-bps.flac...FLAC__STREAM_DECODER_UNPARSEABLE_STREAM
1 files, 1 errors [1]


Also, Reaper can't play it here.
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #2
The FLAC file is corrupted, got this error with the FLACs own FLACTester (comes with the FLAC installer)
Code: [Select]
[1/1]    C:\Users\Antti\Downloads\24-bps.flac...FLAC__STREAM_DECODER_UNPARSEABLE_STREAM
1 files, 1 errors [1]


ok, thanks - i'll forward this to the reaper developer. but with the updated dll posted below, reaper plays the file fine.


Also, Reaper can't play it here.


it can (in the next version). here the updated dll for reaper 2.106: http://landoleet.org/reaper_flac.dll from http://www.cockos.com/forum/showthread.php?p=162266



so foobar should play 24 bps files properly? did you test it with a file?
  • Last Edit: 04 March, 2008, 04:12:56 AM by Dandruff

  • DotNoir
  • [*][*][*][*]
  • Members (Donating)
corrupted(?) 24-bit FLAC file not playable
Reply #3
Here's a 24bit flac I just made. works fine in fb2k.
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #4
alright, thanks!

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #5
reaper developer has no clue why the encoded 24 bps files don't play properly in foobar2000. he said that the flac command line decoder is able to decode it. of course reaper (with the updated dll) itself also can decode it fine ...


http://www.cockos.com/forum/showpost.php?p...mp;postcount=33


strange thing 

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #6
Also, Reaper can't play it here.


it can (in the next version). here the updated dll for reaper 2.106: http://landoleet.org/reaper_flac.dll from http://www.cockos.com/forum/showthread.php?p=162266

Reaper 2.108 now got released with FLAC 1.2.1 encoding and decoding support. But foobar2000 still can't decode 24 bps files created with Reaper. Sound gets distorted heavily.

I've also started a thread about this problem at the FLAC SourceForge project page: http://sourceforge.net/tracker/index.php?f...amp;atid=213478


Any ideas?
  • Last Edit: 08 March, 2008, 12:42:02 AM by Dandruff

  • Egor
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #7
Confirmed, foobar2000 0.9.5.1 cannot properly decode the sample - output is heavily distorted (verified with "Convert to... WAV" option to eliminate possible hardware problems).

Apparently, that's a bug in foobar2000. Winamp 5.52 can play the sample, and the reference FLAC CLI tools version 1.2.0 and 1.2.1 can decode it as well.

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #8
Apparently, that's a bug in foobar2000.

Thanks! That's what the Reaper developer said to me too.


Any Foobar2000 developer reading here?
  • Last Edit: 08 March, 2008, 12:44:19 AM by Dandruff

  • Egor
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #9
Since the topic got new title, I have to say that the sample is not corrupted, it is a valid 1.2.x flac file (at least, the latest reference flac tools say the file is OK).
I guess flac-tester had a problem with that 24-bit file because it is not 1.2.x-compatible. The new compression method was accidently added in the 1.2.1 flac encoder for 24-bit audio, so pre-1.2.0 decoders cannot decode such 24b samples (no backwards compatibility, unfortunately).

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #10
Since the topic got new title, I have to say that the sample is not corrupted, it is a valid 1.2.x flac file (at least, the latest reference flac tools say the file is OK).

good to know, thanks! the reaper developer also didn't trust the flac-tester utility
  • Last Edit: 10 March, 2008, 03:00:51 PM by Dandruff

  • Peter
  • [*][*][*][*][*]
  • Administrator
corrupted(?) 24-bit FLAC file not playable
Reply #11
On this file, libFLAC returns 24-bit samples improperly padded to 32-bit, with most significant bits filled with garbage instead of correct sign expansion. I'd like to hear a reply from Josh about this before I implement a workaround which would have negative impact on everyone's decoding speeds, even on correct files.

This problem isn't 24-bit specific at all, the same issue could potentially occur with 16-bit files.
  • Last Edit: 13 April, 2008, 09:59:08 AM by Peter

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #12
foobar2000 v0.9.5.1 doesn't playback 24 bit flac files properly here! foobar basically can read the file, but the output gets distorted!

here an example: http://www.outburst-audio.com/misc/24-bps.flac (1.2 MB)



FIXED in version 0.9.5.2! Many thanks!

  • Peter
  • [*][*][*][*][*]
  • Administrator
corrupted(?) 24-bit FLAC file not playable
Reply #13
Looks like I accidentally left the fix active in 0.9.5.2 release. I still don't believe that this is a legit behavior of FLAC tools and anybody else converting FLAC decoder's output to floating-point values will run into the same problem.
I hope Josh is looking into this.

Edit: since the original file link no longer works, I uploaded a copy of the offending file.
  • Last Edit: 27 April, 2008, 02:15:11 PM by Peter

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #14
Ok, thank you Peter! I've added your reply to the FLAC SourceForge Tracker: http://sourceforge.net/tracker/index.php?f...amp;atid=213478

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #15
Looks like I accidentally left the fix active in 0.9.5.2 release.


0.9.5.3 still can play this "corrupted" file fine!

  • jcoalson
  • [*][*][*][*][*]
  • Developer
corrupted(?) 24-bit FLAC file not playable
Reply #16
looking at this now...

  • jcoalson
  • [*][*][*][*][*]
  • Developer
corrupted(?) 24-bit FLAC file not playable
Reply #17
ok, short story, I'm pretty sure 24_bps.flac is corrupt, was it created with reaper?  I would like to see the code it is using to call libFLAC because I'll bet it's not passing in properly sign-extended data to FLAC__stream_encoder_process().

the giveaway is that if you decode it to wav with flac.exe and re-encode it with flac.exe, this .flac file is ~20% smaller than 24_bps.flac.  and it all happens to work because of 1) the magic of 2's-complement arithmetic; 2) flac.exe does the same 'fix' that foobar is now doing.  these 2 things together magically cancel out the initial encoding error.

long story:

in this clip, sample 0 of channel 0 is 0 and sample 1 of channel 0 is -364 (0xfffe94 in the wav file).  the first FLAC subframe of channel 0 is a FIXED subframe with order 1, meaning the first sample (0) is stored raw and the second sample (-364) is stored as a residual value "sample[1]-sample[0]" == -364 - 0 == -364

but that is not what is actually in 24_bps.flac, the first residual sample it has encoded is 16776852 (0xfffe94), which is exactly what I would expect if the client passed in bad data (explained next), and also explains why the compression ratio is bad (because 16776852 takes more bits to store than -364)

when samples are passed in to FLAC__stream_encoder_process(), they must be 32-bit signed ints regardless of the sample resolution.  so to pass in -364, the sample value should be 0xfffffe94, but if the client is not sign-extending properly, it will pass in 0xfffe94 and due to the above mentioned magic, it will all appear to work (magic extends even to the md5 summing).

now this could have been avoided if libFLAC did range checking on the input but this noticeably slows things down, which I am hesitant to do for something that should be caught in testing.  (maybe it could be done in debug builds.)

Josh

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #18
I'm pretty sure 24_bps.flac is corrupt, was it created with reaper?


Thanks for the reaply! Yes, it was created with Reaper.

I've forwarded your reply to http://www.cockos.com/forum/showpost.php?p...mp;postcount=44

  • Dandruff
  • [*][*][*][*][*]
corrupted(?) 24-bit FLAC file not playable
Reply #19
Ok, Cockos just fixed it for the next version: http://forum.cockos.com/showthread.php?p=291813