Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: FLAC Stream Decoder Error (Read 48582 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC Stream Decoder Error

I'm in the process of backing up 500 CD-DA discs in FLAC format (using EAC).  I ran a shell script to test (flac.exe -t; flac version 1.1.1)  the 4000 FLAC files on my hard drive so far and found that flac.exe reported errors for 36 files. All errors are the same:

<filename>: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC

The files decompress fine, but now I'm not sure if I got the exact WAVs back. What does this error message mean, and how severe is the error? Moreover, is there a way to avoid it when compressing WAVs to FLAC in EAC?

FLAC Stream Decoder Error

Reply #1
if a file tests fine and the md5sum is non-zero (do "metaflac --show-md5sum file.flac") then you got all the audio data back.  not sure what is causing the error though.  if verify was on during compression and there were no errors then, I would guess hard drive corruption.  unless repeating the test/decode on the same file yields different errors each time, in which case it is probably bad ram or overclocking.

Josh

FLAC Stream Decoder Error

Reply #2
Josh, thanks for your reply. It's always a delight to get an answer from the developer himself.

I tested all md5 sums and they were all non-zero. That means I've got files that fail the flac -t test, but have non-zero md5s.

All FLACs were encoded by EAC, with the following additional command line options:

-T "artist=%a" -T "title=%t" -T "album=%g" -T "date=%y" -T "tracknumber=%n" -T "genre=%m" %s --best --verify

That is, verify was on during encoding. AFAIK EAC does not keep track of FLAC encoding errors, so it's impossible to say whether they encoded without errors. I have always assumed they did because I have the "check from external programs return code" enabled in EAC's compression options and never got a warning.

I think I can rule out hard drive corruption because the bad FLACs occur on two different drives (Seagate/NTFS and Lacie/FAT32). Repeating the test/decode on the same file yields the same error each time, so we can can also rule out bad ram or overclocking.

So the perpetrator must be the encoding process performed through EAC. Could you perhaps explain what generates the FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC error during encoding?

FLAC Stream Decoder Error

Reply #3
Quote
So the perpetrator must be the encoding process performed through EAC. Could you perhaps explain what generates the FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC error during encoding?
[a href="index.php?act=findpost&pid=266004"][{POST_SNAPBACK}][/a]

you mean during decoding right?  that's a decoder error.  it means the decoder was looking for a sync point that begins each frame and there wasn't one.  usually caused by missing or corrupt data at that point; if so, there can be frame losses.

I don't know what else could be going on.  when a wave file is encoded with --verify and it passes, flac has already done everything that decoding would do.  so decoding the exact same flac file again should not produce any errors unless a different decoder with a bug was used.

to debug any more I'll need a sample of a file that is giving the error.

Josh

FLAC Stream Decoder Error

Reply #4
Quote
Quote
So the perpetrator must be the encoding process performed through EAC. Could you perhaps explain what generates the FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC error during encoding?
[a href="index.php?act=findpost&pid=266004"][{POST_SNAPBACK}][/a]

you mean during decoding right?  that's a decoder error.  it means the decoder was looking for a sync point that begins each frame and there wasn't one.  usually caused by missing or corrupt data at that point; if so, there can be frame losses.

I don't know what else could be going on.  when a wave file is encoded with --verify and it passes, flac has already done everything that decoding would do.  so decoding the exact same flac file again should not produce any errors unless a different decoder with a bug was used.

to debug any more I'll need a sample of a file that is giving the error.

Josh
[a href="index.php?act=findpost&pid=266142"][{POST_SNAPBACK}][/a]

 

FLAC Stream Decoder Error

Reply #5
Yes, the error that I get is a decoder error. What I meant is that the error in the FLAC must be created when EAC is processing the encode queue.  EAC does not log the queue processing, so it is impossible to track down failed encodes afterwards, even if --verify was used. What would be the best way to provide you with a sample FLAC?

FLAC Stream Decoder Error

Reply #6
the best way is if you can host it somewhere accessible via http/ftp.  the sourceforge bugtracker (http://sourceforge.net/tracker/?atid=11347...478&func=browse) allows uploads but has a size limit that is usually too big for flac files.

I guess I'm still confused how a file can decode fine but repeatedly give sync errors when testing since they do the same thing (testing just doesn't write the wave file).

Josh

FLAC Stream Decoder Error

Reply #7
OK, I will upload a buggy FLAC tonight.  Not sure if the file actually decodes fine. Decoding produces a WAV with non-zero md5 sum, but  since I don't keep md5 files for ripped CD's I can't compare md5 checksums. I tried reproducing EAC's CRC checksums (see http://www.digital-inn.de/showthread.php?t=28754) but that turned out to be not so easy.

FLAC Stream Decoder Error

Reply #8
I had an interesting situation with the same error.

On two of my FLAC's (using the latest EAC and the latest FLAC codec), i received that error (the warning pops up in foobar, but it plays fine).  it also shows that error when i "test" the track with the FLAC frontend, and also when i decode it (it decodes fine, but the warning still shows in the window).

I then proceeded to re-encode it using EAC from the original disk.  I received the same error, so it was something that seems to be inherent in the wav file extracted from the CD.

THis happened on two tracks, on separate disks.  And both times, i tried to re-rip it from the original source and it still gave the same error.

I just decoded it and re-encoded it back to FLAC, and it is fine now

any idea what it is?  looking at the situation, it seems it is not data corruption.

FLAC Stream Decoder Error

Reply #9
Quote
...
any idea what it is?  looking at the situation, it seems it is not data corruption.[a href="index.php?act=findpost&pid=266206"][{POST_SNAPBACK}][/a]

no idea.

to make sure it is not flac, start with a wave file and encode that.  if you don't get the same error every time at the same place with the same file it is unlikely to be flac.

Josh

FLAC Stream Decoder Error

Reply #10
I looked at your files quickly... the sync error seems to be caused by the ID3v1 tag at the end of the files, so it's not affecting the decoding.  flac is supposed to be id3 tag aware so I'll look at why it's reporting a sync error in this case.  the audio is fine though.

Josh

FLAC Stream Decoder Error

Reply #11
Thanks Josh, that's good news. I guess now I don't have to re-rip the source discs for the buggy FLACs.

FLAC Stream Decoder Error

Reply #12
OK, found the problem.  it is a decoder bug that is exposed when there is an id3 tag at the end of the file AND the last frame of the audio stream has a certain blocksize.  integrity of the audio is not affected but the sync error is annoying.  no need to re-encode either.

it's fixed in CVS and will be in the next release.

Josh

FLAC Stream Decoder Error

Reply #13
Quote
OK, found the problem.  it is a decoder bug that is exposed when there is an id3 tag at the end of the file AND the last frame of the audio stream has a certain blocksize.  integrity of the audio is not affected but the sync error is annoying.  no need to re-encode either.

it's fixed in CVS and will be in the next release.

Josh
[a href="index.php?act=findpost&pid=267539"][{POST_SNAPBACK}][/a]


interesting.  yea it has happened to me a bunch, and i just decoded and reencoded (which stripped the id3 tag, i guess).  i did it because foobar always pops up a message and i wanted it to go away

so a fix would be to set EAC to not "add ID3 tag", huh?  in fact, the ID3 tag really does nothing and has no place/purpose in a flac file, cuz it uses a different tagging system?

FLAC Stream Decoder Error

Reply #14
Quote
so a fix would be to set EAC to not "add ID3 tag", huh?  in fact, the ID3 tag really does nothing and has no place/purpose in a flac file, cuz it uses a different tagging system?[a href="index.php?act=findpost&pid=267597"][{POST_SNAPBACK}][/a]

yeah, if you can avoid id3 tags on FLAC files, do it, use native FLAC tags instead.  the spec does not require compliant implementations to support id3.  even though the standard tools do there's no guarantee it will stay like that.

Josh

FLAC Stream Decoder Error

Reply #15
Josh, many thanks for sorting this out. Glad to hear I don't have to re-rip/re-encode.

Cheers,
Zennon

FLAC Stream Decoder Error

Reply #16
I was wondering if you could help me out. I have a bunch of flacs (with no access to the original sources) that I encoded but give the LOST_SYNC error when verified. The strange thing is they will play fine in Media Monkey if a non LOST_SYNC file is played first (?). Anyway, is there anyway to fix the files? flac -d doesn't work. It gives the same error, and if you tell decode through errors is says something about the source file being to big for a single wav chunk. Note: Yes, these were originally encoded with an id3 tag, silly of me...

Any ideas on how to fix the files? I do have a 4MB sample (its an intro to a "song") that I could email over if anyone needs to see it. Feel free to reply here or email me at maps1@nesurf.com.

FLAC Stream Decoder Error

Reply #17
How about using an ID3 editor to just chop the ID3v1 tag off? A dumb editor which doesn't recognize FLAC would be enough, in which case renaming the .flac to .mp3 will allow you to edit tags.

Alternatively, you could chop 128 bytes off from the end of the file for the same effect.

FLAC Stream Decoder Error

Reply #18
Quote
How about using an ID3 editor to just chop the ID3v1 tag off? A dumb editor which doesn't recognize FLAC would be enough, in which case renaming the .flac to .mp3 will allow you to edit tags.

Alternatively, you could chop 128 bytes off from the end of the file for the same effect.
[a href="index.php?act=findpost&pid=292171"][{POST_SNAPBACK}][/a]

If someone would write a CLI Windows utility to remove any/all IDv1 and IDv2 tags from FLAC files that would be a great asset. Unfortunately too many tag editors and audio programs that convert/save to FLAC are using IDv1 or IDv2 tags today inside FLAC files. Some use both IDv tags and Vorbis tags, others just use IDv tags.

I have written to some developers about this and about the Spread FLAC campaign, but many audio apps authors appear nowadays to reside in China (about 80% of them which I have written to), and it seems they don't know much about the FLAC format, let alone about the need to use Vorbis style tags inside FLAC files. Maybe Josh should publish the FLAC developer docs in Chinese

It wouldn't hurt, Josh, to put a real emphasis on your site, in your docs and in your program code comments for developers to use Vorbis tags only and to stay away from using IDv1 or IDv2 tags inside FLAC files that their programs edit or create, as many developers are so used to the MP3 tagging formats. Just my 2 cents.


FLAC Stream Decoder Error

Reply #20
Quote
I was wondering if you could help me out. I have a bunch of flacs (with no access to the original sources) that I encoded but give the LOST_SYNC error when verified. The strange thing is they will play fine in Media Monkey if a non LOST_SYNC file is played first (?). Anyway, is there anyway to fix the files? flac -d doesn't work. It gives the same error, and if you tell decode through errors is says something about the source file being to big for a single wav chunk. Note: Yes, these were originally encoded with an id3 tag, silly of me...

Any ideas on how to fix the files? I do have a 4MB sample (its an intro to a "song") that I could email over if anyone needs to see it. Feel free to reply here or email me at maps1@nesurf.com.

if the lost sync is at the end of the file it could be tags but I'd have to see the file.  I'll email you for the sample.

as for the chinese docs... good idea but someone will have to volunteer for the translation.  our russian version of the FLAC site has fallen out of date too for lack of maintenance.

and yes, now that vorbis comment adoption has increased it's probably time for more stern wording on the site.  I'm hesitant to pull support altogether because id3v2 is being used in some products for album art.

Josh

FLAC Stream Decoder Error

Reply #21
Quote
Well, have you tried Case's Tag?

I believe I'm right in saying you can either remove all tags, or just ID3v2, using Tag.

You can't specify to just remove ID3v1.

Obviously it would be fine to remove all (--remove) if there were no VORBIS tags present as well.
I'm on a horse.

FLAC Stream Decoder Error

Reply #22
Quote
I was wondering if you could help me out. I have a bunch of flacs (with no access to the original sources) that I encoded but give the LOST_SYNC error when verified. The strange thing is they will play fine in Media Monkey if a non LOST_SYNC file is played first (?). Anyway, is there anyway to fix the files? flac -d doesn't work. It gives the same error, and if you tell decode through errors is says something about the source file being to big for a single wav chunk. Note: Yes, these were originally encoded with an id3 tag, silly of me...

Any ideas on how to fix the files? I do have a 4MB sample (its an intro to a "song") that I could email over if anyone needs to see it. Feel free to reply here or email me at maps1@nesurf.com.

got the file.  it's corrupted.  I can see in a hex editor that there are big blocks of zeroes where the middle of the id3v2 tag and beginning of the FLAC stream should be.

flac -dF is currently not able to decode through errors like this.

Josh

FLAC Stream Decoder Error

Reply #23
Quote
Quote
Well, have you tried Case's Tag?

I believe I'm right in saying you can either remove all tags, or just ID3v2, using Tag.

You can't specify to just remove ID3v1.

Obviously it would be fine to remove all (--remove) if there were no VORBIS tags present as well.
[a href="index.php?act=findpost&pid=292269"][{POST_SNAPBACK}][/a]

You can --force APEv2 --remove all (syntax might be wrong, but you get the idea.)

Can't it do the same with FLAC?

FLAC Stream Decoder Error

Reply #24
Quote
I believe I'm right in saying you can either remove all tags, or just ID3v2, using Tag.

You can't specify to just remove ID3v1.

Obviously it would be fine to remove all (--remove) if there were no VORBIS tags present as well.

I uses Case's Tag in a batch file to solve this problem. The batch file works as follows:

1. Creates an empty text file with the .tag extension
2. Uses Case's Tag to:
i) copy all tags from the flac file to the .tag file with --force ape2 & --nocheck
ii) remove all tags from the flac file
iii) copy the tags from the .tag file back to the flac file. Case's tag will automatically use the right format.
3. Deletes .tag file

One caveat: Do not stop the process in the middle of removing the tags from the flac file as the flac file will likely become corrupted. I.e. backup your flac files first and delete the backups when the process is done. I haven't incorporated the backup process into the batchfile yet but I plan to when I get some time.

I've tried using --force flac --remove in a single command but for some reason it often fails to remove the ID3V1 tags.