flac icon indicating copy to clipboard operation
flac copied to clipboard

Maxing out the number of PICTURES flac.exe can handle: "ERROR: 2 consecutive FLAC__STREAM_DECODER_END_OF_STREAM events."

Open H2Swine opened this issue 9 months ago • 2 comments

Corner case, surely. Attachment has 1021 pictures, running successive re-encodings with many at the time. Using 1.5.0 for Windows.

  • Trying to run another flac -f --picture to add one more, yields "ERROR: 2 consecutive FLAC__STREAM_DECODER_END_OF_STREAM events." We are way below the max metadata size; Mp3tag can add more, and flac -t validates.
  • Also, and "maybe worse" is refusing without warning: Somewhere 960 to 1020 pictures added, running another it simply does not add any.

It seems something has changed over the years. 1.2.1 returns " ERROR: while decoding FLAC input, state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC"

ManyPictures1frame.zip

(Also I see that only 64 can be added at the time, but exceeding that gives an appropriate error message.)

H2Swine avatar Mar 16 '25 13:03 H2Swine

I'm pretty sure the culprit is here

https://github.com/xiph/flac/blob/8d648456a2d7444d54a579e365bab4c815ac6873/src/flac/encode.c#L70

As you might understand, this has a low priority

ktmf01 avatar Mar 16 '25 18:03 ktmf01

Understandable. I also see that metaflac can exceed that bound.

And meanwhile, I notice what ffmpeg does:

[flac @ 00000185f096b640] Number of streams exceeds max_streams parameter (1000), see the documentation if you wish to increase it [flac @ 00000185f096b640] Error parsing attached picture. [in#0 @ 00000185f095f880] Error opening input: Cannot allocate memory Error opening input file 4sec-silence.flac-ffmpeg.flac. Error opening input files: Cannot allocate memory

"see the documentation" rather than offering the information of a simple -max_streams <highernumber> . So, asking trouble.

Close if you find appropriate.

H2Swine avatar Mar 17 '25 16:03 H2Swine