gepa21 / FlacBox

FlacBox clone of flacbox.codeplex.com
5 stars 0 forks source link

FlacExceptions when reading seemingly correct FlacFiles #1

Open Ekmansoft opened 9 years ago

Ekmansoft commented 9 years ago

Hi,

I am working on a program for analyzing sound level, dynamics and clipping in any music library. For this I am using the FlacBox code.

However, I receive a few types of FlacExceptions when reading certain flac files:

The files were ripped using a recent version of dbPoweramp (15.2.0.3), and I ran over 10000 files, and around 50 failed with the following errors.

Exception:FlacBox.FlacException: Invalid subframe coefficient precision Exception:FlacBox.FlacException: Subframe type is set to reserved=17 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 Exception:FlacBox.FlacException: Subframe type is set to reserved=4 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data Exception:FlacBox.FlacException: Zeros expected for alignment padding

I have tried re-ripping most of the files in dbPoweramp, but the results are the same afterwards.

I am currently trying to find out if this is due to a dbPoweramp problem or if it is a problem in FlacBox.

Please help me in pinpointing it!

Regards, Kenneth

The complete exceptions file list (the rest can be provided if needed)

\NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Kaiser Chiefs\Education, Education, Education & War\01 Kaiser Chiefs - The Factory Gates.flac 9370368 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 vid FlacBox.FlacReader.ReadSubframe() i C:\Users\Kenneth Ekman\Documents\Visual Studio 2013\Projects\flacbox-69709\FlacBox\FlacBox\FlacReader.cs:rad 278
vid FlacBox.FlacReader.Read() i C:\Users\Kenneth Ekman\Documents\Visual Studio 2013\Projects\flacbox-69709\FlacBox\FlacBox\FlacReader.cs:rad 157
vid FlacBox.AsIsWaveSampleMixer.d__0.MoveNext() i C:\Users\Kenneth Ekman\Documents\Visual Studio 2013\Projects\flacbox-69709\FlacBox\FlacBox\WaveSampleMixer.cs:rad 24
vid FlacAnalyze.Program.AnalyzeFile(String filename, Boolean level) i C:\Users\Kenneth Ekman\Documents\Visual Studio 2013\Projects\flacbox-69709\FlacBox\FlacAnalyze\Program.cs:rad 416

Here is the complete list of failing tracks:

\NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Sampler Volume 1\08 Hector Berlioz - Berlioz (Smphonie Fantastique.flac 10932096 44100 16 2 Exception:FlacBox.FlacException: Invalid subframe coefficient precision \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Telarc Sampler, Vol. 2\04 Slatkin - Conclusion.flac 8281980 44100 16 2 Exception:FlacBox.FlacException: Invalid subframe coefficient precision \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Bruce Springsteen\The River\04 Bruce Springsteen - Fade Away.flac 12618480 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=17 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Debbie Gibson\Anything Is Possible, Disc 1\02 Debbie Gibson - Anything Is Possible.flac 9967776 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=17 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Debbie Gibson\Anything Is Possible, Disc 1\03 Debbie Gibson - Reverse Psychology.flac 11802924 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=17 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Debbie Gibson\Anything Is Possible, Disc 1\12 Debbie Gibson - Mood Swings.flac 10327044 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=17 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Debbie Gibson\Anything Is Possible, Disc 1\16 Debbie Gibson - This So-Called Miracle.flac 19780320 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=17 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Associates, The\Wild and Lonely\02 Associates, The - Fever.flac 12787236 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Associates, The\Wild and Lonely\06 Associates, The - The Glamour Chase.flac 13092996 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Associates, The\Wild and Lonely\10 Associates, The - Ever Since That Day.flac 13202364 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Dayeene\United Soul Power\Dayeene - 14 - United Soul Power (Clean Mix).flac 11968740 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Five Star\Luxury of Life\10 Five Star - Winning.flac 9657900 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Frankie Goes to Hollywood\Welcome to the Pleasuredome\08 Frankie Goes to Hollywood - Happy Hi.flac 11113200 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 01 - Mona Lisa Smiles.flac 13494600 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Kaiser Chiefs\Education, Education, Education & War\01 Kaiser Chiefs - The Factory Gates.flac 9370368 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Skunk Anansie\Paranoid and Sunburnt\Skunk Anansie - 10 - 100 Ways to Be a Good Girl.flac 10628100 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Sampler Volume 1\09 Aaron Copland - Copeland (Rodeo).flac 8596560 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Telarc Sampler, Vol. 2\09 Shaw - Carmina Burana, Ego Sum Abbas.flac 4465860 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Telarc Sampler, Vol. 2\20 Slatkin - Fugue.flac 7795116 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=18 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Bruce Springsteen\The River\01 Bruce Springsteen - Point Blank.flac 16155300 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=19 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Ultra Naté\Situation; Critical\05 Ultra Naté - It's Crying Time.flac 10221204 44100 16 2 Exception:FlacBox.FlacException: Subframe type is set to reserved=4 \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Foreigner\Foreigner\10 Foreigner - I Need You.flac 13799184 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Max Sharam\Million Year Girl\Max Sharam - 02 - Coma.flac 9935436 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Patti Rothberg\Between the 1 and the 9\Patti Rothberg - 03 - This One's Mine.flac 6832560 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Patti Rothberg\Between the 1 and the 9\Patti Rothberg - 08 - Perfect Strangers.flac 8586564 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Patti Rothberg\Between the 1 and the 9\Patti Rothberg - 10 - Change Your Ways.flac 6543264 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Skunk Anansie\Post Orgasmic Chill\Skunk Anansie - 07 - Secretly.flac 12599076 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\TLC\Ooooooohhh...On the TLC Tip\TLC - 10 - Bad by Myself.flac 10397016 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Zbigniew Preisner\Trois Couleurs; Bleu\Zbigniew Preisner - 15 - The Battle of Carnival and Lent II.flac 1980384 44100 16 2 Exception:FlacBox.FlacException: Unexpected end of stream: bit reader needs data \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 04 - All I Do.flac 15729000 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 05 - SSHHH.flac 12965400 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 06 - Perfect Love.flac 16385796 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 08 - Heavy Smile.flac 14144340 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 09 - Calling.flac 14375424 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Jane Child\Here Not There\Jane Child - 12 - Here Not There.flac 9543240 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Midge Ure\The Works\04 Midge Ure - Call of the Wild.flac 11525388 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Patti Rothberg\Between the 1 and the 9\Patti Rothberg - 04 - Treat Me Like Dirt.flac 12874260 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Patti Rothberg\Between the 1 and the 9\Patti Rothberg - 05 - Looking for a Girl.flac 6753180 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Patti Rothberg\Between the 1 and the 9\Patti Rothberg - 11 - Remembering Tonight.flac 7205940 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\03 Scritti Politti - Absolute.flac 11700024 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\07 Scritti Politti - Lover to Fall.flac 11136720 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\08 Scritti Politti - Wood Beez (Pray Like Aretha Franklin).flac 12705504 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\09 Scritti Politti - Hypnotize.flac 9457980 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\10 Scritti Politti - Flesh & Blood.flac 14808780 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\11 Scritti Politti - Absolute (Version).flac 16405200 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Scritti Politti\Cupid & Psyche 85\13 Scritti Politti - Hypnotize (Version).flac 17457720 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Sneaker Pimps\Splinter\Sneaker Pimps - 12 - Wife by Two Thousand.flac 16646280 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Artists\Zbigniew Preisner\Trois Couleurs; Bleu\Zbigniew Preisner - 16 - Reprise - Flute (Closing Credits Version).flac 6223980 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Sampler Volume 1\10 Johann Pachelbel - Pachebel (Canon).flac 7739844 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Telarc Sampler, Vol. 2\10 Boston Symphony Orchestra - Allegro con brio (excerpt).flac 10775100 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding \NAS-34-6E-94\Backup\Music_20141123\MusicMaster\CD Classical\Various Artists\Telarc Sampler, Vol. 2\11 Various Artists - [Unspecified] Excerpt.flac 6018180 44100 16 2 Exception:FlacBox.FlacException: Zeros expected for alignment padding

Ekmansoft commented 9 years ago

I should add that all of the above tracks have been converted to mp3/aac files without problems, using dbPowerAmp...

Ekmansoft commented 9 years ago

I think I have found the problem!

In FlacReader.cpp line 290, this line:

        int subframeBitsPerSample = FrameBitsPerSample;

should be changed into:

        int subframeBitsPerSample = FrameBitsPerSample - this.wastedBitsPerSample;

Should I supply a patch or something?

/ Kenneth

Ekmansoft commented 9 years ago

Correction: The above helped for some files, but failed for others.

The correct correction is:

  int subframeBitsPerSample;
  if (type == SubframeType.SubframeConstant)
  {
    subframeBitsPerSample = FrameBitsPerSample - wastedBitsPerSample;
  }
  else
  {
    subframeBitsPerSample = FrameBitsPerSample;
  }

Which has now passed on all my 13333 FLAC tracks.