-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial download is too big #2
Comments
@Borewit Any thoughts? 🙏 Would love to help out if this is an issue. |
It is not a coincidence at all. It has to do with the duration. A constant bit rate (CBR) (like CBR/320) encoded MP3, is easier to predict the duration based on the file size, because the bitrate is constant. A variable bitrate (VBR) requires a Xing header to tell the duration, if that is not present, the only option left is to parse the entire file. But that last resort, is (should) only be taken if the duration flag is set to true. So enabling the duration flag means, the duration is so important to me, if takes you parsing the entire file, then that is what it takes. If you think there is room for improvement, your help is very welcome. |
@Borewit Thanks for the detailed explanation! I don't need the duration though so I've set the duration flag to |
In theory, yes. |
Doesn't seem to be a way around it, so I'm closing this. |
Thanks a lot @icidasset for you donation! I was already happy you gave me feedback on music-metadata-browser. The MPEG-parser responsible for handling MP3 is a very tricky piece of code, which is the logical consequence of the message specifications with all the slightly different appearances. After misread your issue last time, it looks like you experience this issue with CBR. With CBR there should be no reason to parse the entire file, because the duration is linear with the size, if you stream, make sure you pass the file/content size to the parser (example: parseStream function) e.g.: const metadata = await mm.parseStream(someReadStream, 'audio/mpeg', {
fileSize: resp.headers['content-size'] // Pass the Content-Size from the HTTP-response to the parser
}); Can you check if the size is passed Steven? I noticed that some CBR encoded streams have some odd frames in the beginning causing the parser to fail to detected the CBR pattern by examine the first frame. So that could be explanation, This utility helped me as additional reference MPEG-Audio-Frame-Header to decoded information per frame. If you have a Windows machine, you could use that, to get some more clarity. Let's investigate a bit further before we close the issue. If there is not good justification for music-metadata to request so much data, it should be addressed. Otherwise it defeats this purpose of this great partial download client isn't?. |
Joined the chat 👍 Thanks for the invite! I'm using I've double checked if the file size is actually saved and is correct, which is the case. Here's the timeline of the requests:
I'm on Mac, I'll see if I can find a similar tool to list the frames. |
Can you please provide me with a sampe Steven? |
Thanks, but I am getting error on those: <?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>6B7FFABF8C2D5CF4</RequestId>
<HostId>Gd6lkgIYzXhGRZJ+rboZDYlLc99qySpCA+7ltcFxr9xgFwqILjgMA8gnBo/kYxyVKR7Eul+VMQg=</HostId>
</Error> |
🤦♂️ Sorry about that, I thought they were set to public, should work now. |
I think there are two underlying problems Steven.
Although solving just one them would already solve your issue, can you help me debugging the second issue? Can you figure out why It should be filled with the HTTP header Content-Length: https://github.com/Borewit/streaming-http-token-reader/blob/112a0ff0f10b0e85274a622858774d9dc5e4f518/src/streaming-http-token-reader.ts#L168 So the correct behavior should be: with the duration flag set to false (and the fixed duration flag handling), you should get a duration back. |
Released music-metadata-browser v0.7.1, should handle duration properly. |
Thanks @Borewit! Just upgraded to In my testing, there doesn't seem to be any issues with the var reader = new StreamingHttpTokenReader(url, {})
reader.init().then(_ => {
console.log(reader.fileSize)
return musicMetadata.parseFromTokenizer(
reader,
reader.contentType,
{ duration: false }
)
}).then(_ => {
console.log(reader.fileSize)
}) Further notes:
|
Anyway, released a new version of streaming-http-token-reader, fixed an incorrect dependency on music-metadata: v0.0.3 |
Case closed! Thanks so much @Borewit ! |
Hey again 👋
I was trying out this add-on and noticed that for most of my files (not all of them), there are multiple partial downloads that are way too big (between 2.5 and 3.2MB). Is this expected?
If not, the only differences I could find between the faulty ones and the working ones is that the faulty ones have a bitrate of 320 kbps and the stereo channel mode (working ones use joint stereo). But I assume that's just a coincidence and none of these things matter? 🤔
Tag formats used in faulty files:
Tag formats used in working files:
Options I used:
Example response of a faulty one:
The text was updated successfully, but these errors were encountered: