#42 Decoded flac file does not match input

closed-works-for-me
5
2003-09-03
2002-07-22
Anonymous
No

For certain files, wav->flac->wav produces a wave file
that does not match the original. On decode, flac warns
that the md5 check has failed.

I noticed that when copying a number of tracks to my
HD for jukebox-style playback, I heard pops and clicks (I
know what you're thinking, but they are not in the wave
files).

I'll have to see if I can come up with a smaller, non-
copyrighted sample, but one way to replicate the
problem is to extract track 1 or 2 from Blood Money
(Tom Waits) and encode either one using flac. I'm using
EAC with offsets corrected for my drive; the MD5
signatures I'm getting for tracks 1 and 2 are

5314638e48c15a1007489f4946a09ae4
and
c5f3865e46c1471d65541728c64cae76
respectively.

I'm using an Athlon 1800+.

Michael Dougherty
mdougherty@opus1.com

Discussion

  • Josh Coalson

    Josh Coalson - 2002-07-23

    Logged In: YES
    user_id=78173

    I wouldn't worry about the copyright issue; here is a way to
    narrow it down to just a few samples:

    1. First encode the whole file using -V. Note the point at
    which the error occurs. Now do the same thing one or two
    more times. It should fail at the exact same spot. If it
    doesn't, report it back here, but it's very unlikely to be
    flac.

    I noticed you mentioned you're running on an Athlon.
    Another user submitted a similar bug that was not repeatable
    (i.e. the error occurred in different places in the file
    with different runs). If this happens to you let me know;
    here is the link:

    http://sourceforge.net/tracker/index.php?func=detail&aid=542501&group_id=13478&atid=113478

    2. If it is repeatable, do the same as step 1, using
    progressively lower -# options. The default for flac is -5,
    so next use -4, -3, ... until you get to the lowest number
    that the error exists.

    3. Use --skip to skip over the samples that are encoding
    correctly. The number of samples to skip is the largest
    number that is <= the sample number of the verify error AND
    is an integer multiple of the blocksize. The blocksize will
    be the number following "-b" in the list of options flac
    prints out before encoding. For example, if the verify
    error occurs at sample 345421 and the blocksize is 4608, the
    number of samples to skip is (345421 DIV 4608) * 4608 =
    74*4608 = 340992. Use this as the number to --skip. The
    verify error should now occur as soon as you start encoding.

    4. Use a WAVE file editor to cut the same number of samples
    that you skipped off the front of the file. You can also
    cut off the end of the file, leaving only 'blocksize'
    samples. Reencode this file with flac -V to make sure
    everything was done correctly and the file is still failing.

    5. Upload the chopped file here and I'll track down the bug.

    Thanks,
    Josh

     
  • Nobody/Anonymous

    Logged In: NO

    I attempted to attach a comment to the issue you referenced
    (542501) but I'm not certain if it worked or not, as that issue
    is closed.

    I have tested this now on two Windows 2000 SP2 systems.
    On the Athlon, encoding with -V failed on 10 out of 20
    attempts for a particular file. On the Pentium, encoding with -
    V failed on 0 attempts out of 10 before I assumed it was ok.
    Even when I encode the files from the Athlon machine over
    the network, things are fine, so I don't think there's a
    hardware problem or a Win2k problem. Perhaps there is a
    compiler optimization problem.

    Michael Dougherty

     
  • Jon Colverson

    Jon Colverson - 2002-08-16

    Logged In: YES
    user_id=479642

    Hi, I'm also having a problem of failed verifications. I'm
    using flac 1.0.3 on Linux on a Duron 600 machine. These
    problems have also occured with Windows XP on the same
    machine and with different versions of flac. The binary I'm
    currently using is the one in Debian package
    flac_1.0.3-2_i386.deb
    http://packages.debian.org/testing/sound/flac.html
    The problem seems to occur only at compression levels 4 and
    above. It doesn't always happen on every attempt, but when
    it does occur, it does so at the same sample and with the
    same expected/got results. I had some trouble trying to use
    the options to tune the compression to find out which
    feature was causing the errors. flac reported that at -3
    it's options are "-P- -b 4608 -l 6 -q 0 -r 3,3 -R 0" but
    when I tried substituting this for the -3 in the command
    line I got the error "ERROR: invalid option '-R'". When I
    tried removing the -R I got the verify error at the same
    sample as usual. I will attach test case wav files with
    three of the 4608 sample blocks which are failing.
    iits1792.wav fails much more frequently than the other two.

    iits392.wav
    Absolute sample=392, frame=0, channel=0, sample=392,
    expected -1504, got -1376
    fails approximately once every 150 tries

    iits1792.wav:
    Absolute sample=1792, frame=0, channel=0, sample=1792,
    expected -3316, got -3284
    fails approximately once every 3 tries

    iits2430.wav:
    Absolute sample=2430, frame=0, channel=1, sample=2430,
    expected -7, got -39
    fails approximately once every 500 tries

    I am monitoring this bug, please let me know if there's any
    other information that would be helpful.

    Thanks.

     
  • Josh Coalson

    Josh Coalson - 2002-08-21

    Logged In: YES
    user_id=78173

    Copied this comment over from #598042:

    Reported, per FLAC's request :) The input .wav file is
    927MB, so it'll be a bit rough to distribtue to reproduce
    on other systems.
    I just tried a second pass with identical options, and
    now all is OK. Perhaps this is related to the AMD
    Duron encoding bug?
    ---
    options: --delete-input-file -P- -b 4608 -m -l 8 -q 0 -r 0,4 -
    R 0 -V
    lfb2002-06-08skm184.wav: WARNING: skipping
    unknown sub-chunk 'PAD '
    lfb2002-06-08skm184.wav: 93% complete, ratio=0.585
    lfb2002-06-08skm184.wav: ERROR: mismatch in
    decoded data, verify FAILED!
    Please submit a bug report to
    http://sourceforge.net/bugs/?
    func=addbug&group_id=13478
    Make sure to include an email contact in the
    comment and/or use the
    "Monitor" feature to monitor the bug status.
    Absolute sample=221065121, frame=47974,
    channel=0, sample=929, expected 6
    90, got 706
    lfb2002-06-08skm184.wav: ERROR during encoding,
    state = 15:FLAC__STREAM_ENCODER_
    FATAL_ERROR_WHILE_WRITING
    lfb2002-06-08skm184.wav: ERROR: verification decoder
    returned error 1:FLAC__STRE
    AM_DECODER_ERROR_STATUS_BAD_HEADER
    Verify FAILED! (FLAC__VERIFY_FAILED_IN_FRAME)
    Do not trust G:\Goodtimes 16bit\l
    fb2002-06-08final.flac16\lfb2002-06-08skm184.flac

     
  • Josh Coalson

    Josh Coalson - 2002-08-21

    Logged In: YES
    user_id=78173

    > I just tried a second pass with identical options, and
    > now all is OK. Perhaps this is related to the AMD
    > Duron encoding bug?

    What CPU and OS are you running? If the error doesn't repeat it is probably related.

    Josh

     
  • Josh Coalson

    Josh Coalson - 2002-08-21
    • assigned_to: nobody --> jcoalson
    • status: open --> open-accepted
     
  • Mike Wren

    Mike Wren - 2002-08-21

    Logged In: YES
    user_id=122608

    I'm running an AMD Duron (I think it's an 850MHz, I'll add
    another comment if it isn't) with Windows 2000 SP3. I haven't
    run any hardware/memory integrity tests, but I've not had any
    problems with FLAC or other data corruption prior to this. My
    PC0one of my hardware is overclicked and I have t

    I'm unable to repeat the error after 5 passes.

     
  • Karlheinz Pischke

    Logged In: YES
    user_id=680633

    I have seen the same problem:
    My example is: yes 90125 owner_of_a_lonely_heart

    please tell me what information I could provide to help ?

    please see the "screenshot" to reproduce:

    testflac> flac -V --best -e 01-owner_of_a_lonely_heart.wav

    flac 1.0.4, Copyright (C) 2000,2001,2002 Josh Coalson
    flac comes with ABSOLUTELY NO WARRANTY. This is free software, and
    you are
    welcome to redistribute it under certain conditions. Type `flac' for details.

    options: -P- -b 4608 -m -l 12 -e -q 0 -r 0,6 -V
    01-owner_of_a_lonely_heart.wav: Verify OK, wrote 29410580 bytes,
    ratio=0,617

    testflac> flac -d 01-owner_of_a_lonely_heart.flac -o
    decode/01-owner_of_a_lonely_heart.wav

    flac 1.0.4, Copyright (C) 2000,2001,2002 Josh Coalson
    flac comes with ABSOLUTELY NO WARRANTY. This is free software, and
    you are
    welcome to redistribute it under certain conditions. Type `flac' for details.

    01-owner_of_a_lonely_heart.flac: done

    testflac> flac -t 01-owner_of_a_lonely_heart.flac

    flac 1.0.4, Copyright (C) 2000,2001,2002 Josh Coalson
    flac comes with ABSOLUTELY NO WARRANTY. This is free software, and
    you are
    welcome to redistribute it under certain conditions. Type `flac' for details.

    01-owner_of_a_lonely_heart.flac: ok

    testflac> sum 01-owner_of_a_lonely_heart.wav
    /musik/wav/./yes/90125/01-owner_of_a_lonely_heart.wav
    decode/01-owner_of_a_lonely_heart.wav
    32494 46547 01-owner_of_a_lonely_heart.wav
    32494 46547 /musik/wav/./yes/90125/01-owner_of_a_lonely_heart.wav
    36226 46547 decode/01-owner_of_a_lonely_heart.wav

    Thanks.
    Karlheinz

     
  • Josh Coalson

    Josh Coalson - 2003-09-03
    • status: open-accepted --> closed-accepted
     
  • Josh Coalson

    Josh Coalson - 2003-09-03
    • status: closed-accepted --> closed-works-for-me
     

Log in to post a comment.