Error: "Invalid FLAC preamble" for streams in FLAC format
Opened this issue · 2 comments
Hi,
I'm getting an error Error: Invalid FLAC preamble
when I try to get metadata from a stream in FLAC format.
Here is what I did:
const metadata = await musicMetadata.parseReadableStream(http://stream.radioparadise.com/global-flac, {
mimeType: 'audio/flac',
});
It works fine with other formats except for FLAC, and I think you can probably reproduce it with the above configuration.
Tested with the latest Chrome and Firefox.
Let me know if you need any more details.
Thanks.
I have updated the issue because I was not explicitly setting the mime type, instead I was relying on automatic detection which would set the OGG parser for FLAC and fail.
Now with the mime type and correct parser, the issue arises here.
Interesting problem @bojanvidanovic.
The MIME type is application/ogg
and actually suspect that is the correct MIME type. So the stream is no audio/flac
.
So you should provide the original HTTP MIME type to music-metadata.
But I won't work.
What I suspect is that the stream is not formatted like a FLAC file, but it is an Ogg stream carrying FLAC.
And the Ogg/FLAC combination is not implemented.
I created branch which will throw a more specific error:
music-metadata/lib/ogg/OggParser.ts
Line 119 in 7258478
Which can be triggered with
music-metadata/test/test-http.ts
Lines 69 to 84 in 7258478
Sorry, I do not have a lot time lately.