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_ENCODER_NOT_STREAMABLE (Read 4576 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Hi,

I'm trying to compress a wav file using flac, and I get the following output:

---
D:\>"c:\Documents and Settings\user\Desktop\tools\flac-1.1.0-win\bin\flac.exe" -8 tuek-mono-11khz.wav

flac 1.1.0, Copyright © 2000,2001,2002,2003 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 4096 -b 4608 -m -l 12 -e -q 0 -r 0,6

tuek-mono-11khz.wav: ERROR initializing encoder
                    state = 14:FLAC__STREAM_ENCODER_NOT_STREAMABLE
---

I'm able to successfully compress all my other wav files using flac, just not this one. It's a 11025khz, mono wav file. If it helps, this is the file I'm trying to encode: tuek-mono-11khz.wav.

Please let me know what I'm doing wrong. Thanks.

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #1
It seems there is a bug with FLAC 1.04+

I tried encoding the file with FLAC 1.03 and it worked perfectly.

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #2
Tried FLAC 1.1.0

Generated 2 seconds noise with Cool Edit.
All files are 16bit, mono:

Success: 8000, 16000, 22050, 32000, 44100, 48000, 96000 Hz

Failed: 6000, 11025, 64000, 88200, 192000 Hz

All give the same error:
ERROR initializing encoder
state = 14:FLAC__STREAM_ENCODER_NOT_STREAMABLE

Both Monkey's Audio 3.96 and WavPack 3.97 could compress them all without errors though.

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #3
Do the flac developers know about this bug? If so, is it planned to be fixed in the next release? Or is there some way that I should notify them?

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #4
On the SourcForge page, you can submit bugs for flac, there are a couple there and some are assigned to Josh, so he must check them out.

You can submit the bug HERE

I also tried to encode with the latest version of flac and it failed, it doesn't appear to be in the bug list already!
I know he also reads these forums as well.

You could try and get someone to copile the latest CVS version, just to see if it's broken there? I heard a couple of bugs have been fixed. I don't have acompiler though, so can test it myself.

Cheers,

Kristian


FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #6
I actually had a look around the documents once i read the first post, and i tried the --lax option. It asked for the properties of the file so i presumed i wan't using it correctly. After seeing your post, i redownloaded teh file and specified --lax again, and it encoded fine!! I must have messed up the syntax or something strange!

Anyway, is it quite ok to use lax with this sample rate, if you are not interested in streaming, or would you recommend upsampling or downsampling to the nearest sample rate that doesn't require --lax? Also, how come older encoders 1.0.3 and lower aparently allow this (not that i tested)?
Just curious, i rarely encode anything other than CD quality.

Cheers,

Kristian

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #7
I've looked up the flac docs, and it appears that the following is the case:

FLAC specifies a subset of itself as the Subset format. The purpose of this is to ensure that any streams encoded according to the Subset are truly "streamable", meaning that a decoder that cannot seek within the stream can still pick up in the middle of the stream and start decoding. It also makes hardware decoder implementations more practical by limiting the encoding parameters such that decoder buffer sizes and other resource requirements can be easily determined. "flac" generates Subset streams by default unless the "--lax" command-line option is used. The Subset makes the following limitations on what may be used in the stream:

-The blocksize bits in the frame header must be 0001-0101 or 1000-1110, specifying a fixed-blocksize stream (the exception being the last block as described in the table) and a few allowable blocksizes. This also means that the STREAMINFO metadata block must specify equal mininum and maximum blocksizes.
-The sample rate bits in the frame header must be 0001-1011.
-The bits-per-sample bits in the frame header must be 001-111.

The sample rate bits in the frame header are as follows:

Sample rate:
0000 : get from STREAMINFO metadata block
0001-0011 : reserved
0100 : 8kHz
0101 : 16kHz
0110 : 22.05kHz
0111 : 24kHz
1000 : 32kHz
1001 : 44.1kHz
1010 : 48kHz
1011 : 96kHz
1100 : get 8 bit sample rate (in kHz) from end of header
1101 : get 16 bit sample rate (in Hz) from end of header
1110 : get 16 bit sample rate (in tens of Hz) from end of header
1111 : invalid, to prevent sync-fooling string of 1s

It looks like I'm violating the second rule, which is that the sample rate bits in the frame header is not between 0001-1011, which is why the --lax option becomes necessary. However, I still don't understand *why* this is the case (in terms of why is it technically not possible that 11025Hz files should be able to be streamed), just that that's why I was having trouble encoding the file.

Can anyone shed some light on this? Thanks in advance.

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #8
I guess the confusion is that "subset" is more restrictive that just "not streamable", which is not so clear in the docs.  The subset also limits the range of sample rates a compliant implementation needs to support.  So even though you could use bit code 1101 for the sample rate and store 11025 at the end of the header, and the result would still be streamable, the subset does not allow it.

In practice, embedded apps may or may not support some sample rates anyway and some might handle arbitrary sample rates fine.  If I had it to do over I probably would not have done it like this.  But I would say go ahead with --lax, no need to resample.

There is one annoying thing though, looking at the code, that if you specify --lax it will use 0000 for the bit code for the sample rate and store it in the STREAMINFO block, regardless of the actual sample rate, instead of checking first to see if it will fit in the frame header.  This is a bug that should be fixed, because if fixed the encoder would make a stream that, although not "subset", at least streamable, if that makes any sense.

Josh

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #9
Thanks Josh.

So if my understanding is correct, "subset" is an arbitrary collection of different combinations of sample rates/bits per sample/blocksizes that is defined so that hardware or other implementations only need to support a finite collection of combinations to be flac-compliant. Anything that is not "subset" can still be encoded in flac format, but is not guaranteed to be playable by all flac decoders?

Basically, any "subset" file is streamable, but a streamable file does not have to be "subset".

Is my understanding of this correct?

Also, it would be useful if there was a command-switch like "--optlax" that would try and encode a file in "subset", and if that fails to fall back to "--lax". That way when using programs like flacdrop, you could specify a standard command line that worked with all files, while generating streamable files where possible.

FLAC__STREAM_ENCODER_NOT_STREAMABLE

Reply #10
Quote
Is my understanding of this correct?

Yep.

Quote
Also, it would be useful if there was a command-switch like "--optlax" that would try and encode a file in "subset", and if that fails to fall back to "--lax". That way when using programs like flacdrop, you could specify a standard command line that worked with all files, while generating streamable files where possible.

Hmm, I'd think you'd want at least a warning, but I'll keep it in mind.

Josh